*
The moose likes EJB and other Java EE Technologies and the fly likes Ejbs and Static variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Ejbs and Static variables" Watch "Ejbs and Static variables" New topic
Author

Ejbs and Static variables

Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
Hi,
I wanted to know,
1. Can we have static variables in Ejbs from J2EE point of view
2. Does it affect the performance?
Your help is very much appreciated.
Thanks,
Santhosh.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Static variables are allowed, however you should never write to them due to threading and clustering issues. It is good practice to make any static variables that you may use in your EJBs final also.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Ejbs and Static variables