• 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

MDB and Stateless session bean combination

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahmed,
Ok. I was actually inquiring about the size of the session bean pool.
 
Police line, do not cross. Well, this tiny ad can go through:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic