Static variables are only ok if they are final. If they are not final, they will break the cluster. What that means is that if you cluster your application server (spread it across several machines) each part of the cluster will run in its own JVM.
Say a method on the EJB is invoked on cluster 1 (we will have two clusters – 1 and 2) that causes value of the static variable to be increased to 101. On the subsequent call to the same EJB from the same client, a cluster 2 may be invoked to handle the request. A value of the static variable in cluster 2 is still 100 because it was not increased yet and therefore your application ceases to be consistent. Therefore, static non-final variables are strongly discouraged in EJBs.
Posted Date:- 2021-09-04 07:15:31
What Does A Well-written Oo Program Look Like?
What's The Difference Between An Interface And An Abstract Class?
Difference Between ejbStore() and ejbLoad()?
Is threading is possible in EJB?
What are the issues you face with EJB 3.0 ?
Is Decorator An Ejb Design Pattern?
Why Does Ejb Needs Two Interfaces(home And Remote Interface)
What is the difference between EJB and J2EE?
Why should we use EJB over Spring?
What is a home interface in EJB?
Which EJB protocol is used for communication?
Why don’t we use static in Java EE EJB?
How is consistency maintained by Stateful Session through transaction updates ?
Which is more beneficial: CMP or BMP?
What Is Deployment Descriptor?
Static variables in EJB should not be relied upon as they may break in clusters.Why?
Enlist the changes in EJB 2.1 ?
What Is The Difference Between Ear, Jar And War File?
Differentiate ‘stateful Session’ From ‘entity Bean’?
Which Is More Beneficial: Cmp Or Bmp?
Can I develop an Entity Bean without implementing the create() method in the home interface?
What are transaction attributes?
What is meant by POJO class in Java?
What is advantage of putting business logic in EJB over stored procedure?
What was shortcomings of EJB 2.0 ?
Can we run EJB in web server like Tomcat ?
Enlist the Declarative Transaction types?
Describe The Life Cycle For Stateful Beans.
Enlist the Enterprise Beans types?
What is software architecture of EJB?
What is meant by EJB container?
How many types of session beans are available in EJB?
What are session beans in EJB?