Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How can I create singleton session bean in EJB3.0

 
Ranch Hand
Posts: 30
Hibernate Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have a requirement to implement Singleton session bean with EJB3.0 and JBOSS6.0. (please post with an example) ?
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Prateek Kumar Singh
Ranch Hand
Posts: 30
Hibernate Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic