• 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

MDB and Stateless session bean combination

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a MDB which has an @EJB annotation for the Stateless Session bean. I see multiple instances of MDB's created but they all access only one instance of Stateless Session beans. I would have expected a different instance of Stateless Bean for each instance of MDB. I am printing code of the objects.

@MessageDrivenBean
public class CalculatorMDB {
@EJB Calculator cal;

}

Am I miss understanding anything?. Is there a way to force a different instance of stateless bean for each instance of MDB? The application server is Jboss.
Suggestions appreciated.
-Ahmed
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahmed,
Stateless beans come from a pool. How big is your pool? If it is of size 1, this behavior makes sense.
 
Ahmed Basheer
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne,

The stateless session bean pool size is 30. Also different instances of Message Driven Beans have different thread id so they should get a different instance of stateless session bean but they don't.
Any suggestions of what might be happening is appreciated.

Ahmed
 
Ahmed Basheer
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see now that there are 5 mdbs in the pool but every time mdb receives a message different instance of session bean is created. Is there way to make one to one instance mapping so that every invocation of mdb doesn,t create a new session bean instance. The session bean is injected into mdb through @EJB annotation. It seems mdb resets it's instance variables and creates new instance is instance variable for every message it gets from jms topic.
Suggestions appreciated.
Ahmed
 
Jeanne Boyarsky
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahmed,
Ok. I was actually inquiring about the size of the session bean pool.
 
    Bookmark Topic Watch Topic
  • New Topic