Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MDB and Stateless session bean combination  RSS feed

 
Ahmed Basheer
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
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37234
519
Eclipse IDE Java VI Editor
  • 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
Sheriff
Posts: 37234
519
Eclipse IDE Java VI Editor
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!