This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Wai, The EJB specifications warns against using mutable static members in EJB implementation classes because EJB containers may use several, different class loaders. A class static member is only "static" in a single class loaders. If your EJB container only uses a single class loader for all its EJB instances, then you can safely use a mutable static member -- but your EJB may not be portable (but portability may not be an issue for you :-)
That is what the spec says (section 24.1.2 Programming restrictions)
� An enterprise Bean must not use read/write static fields. Using read-only static fields is allowed. Therefore, it is recommended that all static fields in the enterprise bean class be declared as final. This rule is required to ensure consistent runtime semantics because while some EJB Containers may use a single JVM to execute all enterprise bean�s instances, others may distribute the instances across multiple JVMs.
I agree with above 2 comments, Clusterring and VM's in use are to be considered. If coding is still under some assumptions values can be configured as params and manage the scope of variable to which it is assigned. - Manoj.
Wise thought not always comes to Wise, but Wise thinks for all thoughts.