File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Why can't we use 'static' in EJB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why can Watch "Why can New topic
Author

Why can't we use 'static' in EJB?

rui lin
Greenhorn

Joined: May 19, 2003
Posts: 5
Would you please tell me why?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You can use static variables -- as long as their read-only (final). The reason for not being allowed to use read-write static variables is that the EJB container would have hard time synchronizing the static variable across the cluster.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
rui lin
Greenhorn

Joined: May 19, 2003
Posts: 5
Thanks to Lasse.
 
GeeCON Prague 2014
 
subject: Why can't we use 'static' in EJB?