Design J2EE Applications for Real-time Clustered Environments
This article cannot use the java static variable in a cluster environment, but if we want to use a static variable of the type (only one copy of the value shared by the entire object in the cluster application), what should we use?
A static variable can only be accessed by one Java virtual machine loaded with a single class loader. If you need to share this value with several JVMs, you can use a database, cache (memcached, redis) or any other external system.
@Stateful bean @javax.enterprise.context.ApplicationScoped.
@Stateful
@javax.enterprise.context.ApplicationScoped
, , GlassFish 3.1 ( , ).