• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Will A MDB instance be taken out of service when it encounters a system exception?

 
Clark Lee
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question comes from jdiscuss.A MDB with CMT calls a method of another class which throws a system exception.The correct option not include "The MDB instance will be taken out of service". But in fact when a MDB encounters a system exception,the container will discard the instance. Can anyone explain me sth?
Thanks
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A MDB with CMT calls a method of another class which throws a system exception


The other classes instance if its an ejb will be discared. On the other hand if the instance of the MDB itself throws a system exception then it will be discared.

The point is you need to see that it's the ejb or some other class that is throwing system exception.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt if it makes any difference where the system exception is thrown. After all, it will propagate to the bean. As far as the container is concerned, the bean is in a potentially unstable state, so it will be destroyed.
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt if it makes any difference where the system exception is thrown. After all, it will propagate to the bean. As far as the container is concerned, the bean is in a potentially unstable state, so it will be destroyed.


If the system exception is propogated then the bean will be taken out of service. But it depends upon how you have handled exception in your app. Further for MDB its only the MDB that will go out of service and not the ejb that sends the message and also for other beans if you are catching the system exception in the calling ejb then only the ejb that has thrown system exception will be take out of service.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic