aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How can I create singleton session bean in EJB3.0 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 "How can I create singleton session bean in EJB3.0" Watch "How can I create singleton session bean in EJB3.0" New topic
Author

How can I create singleton session bean in EJB3.0

Prateek Kumar Singh
Greenhorn

Joined: Jan 21, 2011
Posts: 29

Hi guys,

I have a requirement to implement Singleton session bean with EJB3.0 and JBOSS6.0. (please post with an example) ?
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Hi Prateek,
Singleton has been introduced in EJB 3.1 and not in 3.0. You can read about it in our EJB-FAQ

The above FAQ page provides a link to this page which explains the Singleton annotation.

You can also check out the JEE 6 tutorial page to find info about Singleton.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Prateek Kumar Singh
Greenhorn

Joined: Jan 21, 2011
Posts: 29

Hi Ranganathan,

Here idea behind singleton session bean in EJB is We will have a pool of bean instances and that pool will maintain only one bean instance.On each request that bean instance will return to user and get back to pool once job completed. all requests to the singleton will be routed to the single instance of the Singleton bean instance.
A singleton EJB ensures there is only one instance of an EJB in a application. There will be many instances of a stateful session bean (one per session) in a n application.

To maintain the concurrency in your application If you are using container managed concurrency the container may lock on read or write access (or both). So for synchronization programmer need to implement there own logic in application.

In Jboss 6.0 we can create a pool of instance by using @pool annotation. -



this annotation can be applied to a stateless or message driven bean class.

Pool in JBOSS 6.0
Hope this link will help you.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I create singleton session bean in EJB3.0