File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Instance variables on MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Instance variables on MDB" Watch "Instance variables on MDB" New topic

Instance variables on MDB

Doron Orbach

Joined: May 05, 2002
Posts: 8
I know that mdb is stateless.
But, If I use instance variables just for
one invocation of the mdb, for saving me passing parameters to methods, is it ok, or the bean can be used again even if the onMessage method did not finish?

Joined: Mar 29, 2001
Posts: 6
One instance is used to serve one onMessage()... it is safe to use instance variables for a single invocation... but not safe to use these variables for multiple invocations as different invocations might be served by different instances...
Doron Orbach

Joined: May 05, 2002
Posts: 8
Consider Paul's rocket mass heater.
subject: Instance variables on MDB
It's not a secret anymore!