This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes instance variables in MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "instance variables in MDB" Watch "instance variables in MDB" New topic
Author

instance variables in MDB

VJ Nairo
Greenhorn

Joined: Jan 05, 2006
Posts: 11
HI,

I have a scenario in which I need to associate one MDB with one processing class which will actually process the message. The number of instances should be the same as the number of instances of the processing classes. I plan to do this by creating the instance of the processing class in the MDB's create() method. I presume this will work as MDBs cannot mess with each others instance variables.

Is this a correct programming practise and will it work. Let me know your thoughts.

Thanks,
Vijay.
Andreas Schaefer
Ranch Hand

Joined: Feb 13, 2006
Posts: 63
Yes, that is perfectly fine. You do not need to postpone the creation of your processing class to the ejbCreate() method but can do this even in the constructor. Only if you need any EJB resources like the MDB context etc. you need to place that code in the ejbCreate() method.

-Andy
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: instance variables in MDB
 
Similar Threads
MDB and Stateless session bean combination
JMS and instance pool of msg driven beans
Statics and serialization
shared count variables for instances
Listener instances