GeeCON Prague 2014*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
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
 
GeeCON Prague 2014
 
subject: instance variables in MDB