On Mon, 2003-12-22 at 21:29, [EMAIL PROTECTED] wrote: > I am looking for some information as when ejbRemove is called on a message > driven bean. > I understand the fact that there is a JMS session pool that is created to > read JMS messages of the queue and this pool size is 15 by default. > For each of those session, one MDB instance is created. > Can more MDB instances be created and the previously created one removed > (with ejbRemove called on it)? > If yes, I suppose there is some kind of a pool of MDB instances. Where can I > configure this pool? > > We have one of our test where exceptions are thrown from the onMessage of > the MDB. > In this case, it seems that new MDB instances are created, but the old ones > do not seem to go away (or at least, ejbRemove does not seem to be called). > > Thanks in advance for any help. >
It is a bug to throw an uncaught exception of any type from onMessage(). onMessage() is part of the JMS spec NOT the EJB spec. I wish I could delete all the examples on the internet that throw new EJBException() to force a transaction rollback. Use messageDrivenContext.setRollbackOnly() The only exception I can see to this rule is if you have no idea what is going on and want the bean instance discarded, e.g. a NullPointerException. Whether you leak the NullPointerException or not, you've got a bug to fix. If you read the ejb spec it explicity states that ejbRemove is not invoked in the event of a crash by the container or an unhandled throwable leaked from onMessage(). It leaves it as an application problem how any resources allocated in ejbCreate() are cleaned up in that case. See "Missed ejbRemove calls". It is much more scalable to allocate expensive resources from a pool in onMessage() than it is for each MDB instance to hold its own copy. Regards, Adrian > Thomas > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user -- xxxxxxxxxxxxxxxxxxxxxxxx Adrian Brock Director of Support Back Office JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
