Struts and static delegates

Discussions

Web tier: servlets, JSP, Web frameworks: Struts and static delegates

  1. Struts and static delegates (1 messages)

    HI, I have a struts app. I also have several delegate classes that connect to ejbs (session beans) used by my action classes. I was thinking about putting the delegates into a helper class as static properties. That way my action classes can just reference the same delegate. I don't want to have to create a new instance of a delegate with every request an action class handles. However, I'm wondering if this will cause synchronization issues with multiple requests being handle, as our site handles a heavy load of requests. Any suggestions would be appreciated?
  2. Re: Struts and static delegates[ Go to top ]

    The rule of thumb, as I recall it, is that you can not use static attributes that would be referenced in the execute() method, without leaving potential for thread safety issue. Simply because the action is for all, whereas each request would use the execute method. There is nothing that could be deduced from what you have stated, that would imply an exemption from this rule.