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?
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.