Bernd Eckenfels [
http://community.jboss.org/people/b.eckenfels] created the discussion
"Re: Singletons in a J2EE application server"
To view the discussion, visit:
http://community.jboss.org/message/627987#627987
--------------------------------------------------------------
According to the Java EE 6 and EJB 3.1 Specification a Stateless Session Bean with the
@Singleton Annotation is created once for an Application. If the Application is deployed
on multiple VMs (in a Cluster) you have one Instance for each VM.
Of courxe you can have multiple different Singleton Beans.
If the locking and processing of a singleton bean is a problem for application
performance, it could make sense to have multiple. But strictly speaking you wont have a
real singleton anymore. This would be more like Statefull Session Beans. It is not
addressed by the spec, but you could implement it conformant with the Spec by having
multiple Singletons (same class, different name). In that case you would have to care for
pooling andsynchronizing yourself.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/627987#627987]
Start a new discussion in Beginner's Corner at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]