[jboss-user] [Messaging, JMS & JBossMQ] - Re: Bug: Injected EJB objects instantiated on every MDB call

doktora do-not-reply at jboss.com
Wed Mar 26 13:31:56 EDT 2008


I'd bet my software hat on it.

I've added some sop's to the constructors of CalculatorMDB and RecordManagerBean just to make sure that the container is playing by the rules when calling postConstruct:

 CalculatorMDB() {
  |     System.out.println("CalculatorMDB() CONSTRUCTOR");
  |   }
  | 
  |   RecordManagerBean() {
  |     System.out.println("RecordManagerBean::CONSTRUCTOR()");
  |   }
  | 

And here is the output from hitting the "Calculate" button three times on /EJB3Trail/serviceobjects/injection/calculator.jsp

17:24:06,980 INFO  [STDOUT] CalculatorMDB() CONSTRUCTOR
  | 17:24:07,001 INFO  [STDOUT] RecordManagerBean::CONSTRUCTOR()
  | 17:24:07,002 INFO  [RecordManagerBean] ++++++++++++ postConstruct  +++++++++++ 
  | 17:24:07,005 INFO  [STDOUT] The onMessage() is called
  | 17:24:09,997 INFO  [STDOUT] RecordManagerBean::CONSTRUCTOR()
  | 17:24:10,000 INFO  [RecordManagerBean] ++++++++++++ postConstruct  +++++++++++ 
  | 17:24:15,106 INFO  [STDOUT] RecordManagerBean::CONSTRUCTOR()
  | 17:24:15,107 INFO  [RecordManagerBean] ++++++++++++ postConstruct  +++++++++++ 
  | 17:24:15,108 INFO  [STDOUT] The onMessage() is called
  | 17:24:25,052 INFO  [STDOUT] RecordManagerBean::CONSTRUCTOR()
  | 17:24:25,056 INFO  [RecordManagerBean] ++++++++++++ postConstruct  +++++++++++ 
  | 17:24:25,058 INFO  [STDOUT] The onMessage() is called
  | 


One CalculatorMDB object was created and four (?) RecordManagerBean objects. 

Doesn't seem right to me.

cheers
dok

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139060#4139060

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139060



More information about the jboss-user mailing list