• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on Singleton Session Bean Initialization

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Source: EJB 3.1 Spec.



4.8 Singleton Session Beans

A Singleton session bean is a session bean component that is instantiated once per application. In cases
where the container is distributed over many virtual machines, each application will have one bean
instance of the Singleton for each JVM.



Thus,Each Application has only one instance of Singleton Bean.


4.8.1 Singleton Initialization
In some cases, explicit initialization ordering dependencies exist between multiple Singleton compo-
nents in an application. The DependsOn annotation is used to express these dependencies. A
DependsOn dependency is used in cases where one Singleton must initialize before one or more other
Singletons. The container ensures that all Singleton beans with which a Singleton has a DependsOn
relationship have been initialized before PostConstruct is called.



However,from the above paragraph I understand that "there can be multiple Singleton's".

"The container ensures that all Singleton beans with which a Singleton has a DependsOn relationship have been initialized"

Q1. How is this possible as the topic 4.8 says that "Each Application has only one instance of Singleton Bean." ?

Please advise.
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Q1. How is this possible as the topic 4.8 says that "Each Application has only one instance of Singleton Bean." ?


Each Application has only one instance of Singleton Bean of a certain class. There can be many Singletons in an application.

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frits.
I understood the statement now.
 
reply
    Bookmark Topic Watch Topic
  • New Topic