Re: Statics and Synchronization
johan <[email protected]>
| Newsgroups | gmane.comp.java.sun.ejb.general |
|---|---|
| Message-ID | <[email protected]> |
I'm not from Sun, but still a bit curious about the possibilities to use instance fields of stateless session beans, in favor of static fields. Would it be acceptable to use a session bean, which could have its pool size set to 1, to keep the static data assigned to an instance field? The SLSB would need a get-method with lazy initialization of the "static" content (or use the setSessionContext template method) and a refresh-method to re-initialize the value of the instance field. /Johan On 2003-12-29, at 23.22, Bob Lee wrote: > We have a global configuration object that's expensive to create. In > the > past, we had only one instance per JVM and everything performed > acceptably. The object contains a list of servers. Servers can be > removed from the list at runtime if they go down, so the object needs > some synchronization. > > A coworker on another team read the "no statics, no synchronization" > rule in the specification and has removed the synchronization and now > creates a copy of the object per EJB. This kills performance. > > The coworker is reluctant to revert the code until they are convinced > that doing so would not violate the spec. I've explained that this is > meant for bean providers, more specifically business objects that are > expected to be transactional and unique across the entire application, > not applications like this where it's acceptable to have multiple > copies, but you want to limit the number for the sake of performance. > > Can someone from Sun please chime in and provide the needed support to > convince this person? > > Thanks, > Bob > > ======================================================================= > ==== > To unsubscribe, send email to [email protected] and include in the > body > of the message "signoff EJB-INTEREST". For general help, send email to > [email protected] and include in the body of the message "help". > =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [email protected] and include in the body of the message "help".