BTMLifecycleListener shutting down too early

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BTMLifecycleListener shutting down too early

Thomas Beckmann
Hi,

I've integrated the bitronix TM into tomcat and created an application with
spring, activemq and camel. I used the ResourceLoader to init a
PoolingDataSource and a PoolingConnectionFactory and made all that available
through jndi.

Everything worked fine except during shutdown.

I've seen that that the  Bitronix.tm.integration.tomcat55.BTMLifecycleListener
is shutting down the TM and the pools before the ContextLoaderListener of
spring has a chance to destroy the ApplicationContext.
That caused an exception in DefaultMessageListenerContainer saying that the
TransactionManager has already shut down. After that the Container tries to
refresh the lost connection and the PoolingConnectionFactory just
reinitializes on a call to createConnection.
Because of that the pool was up and running again (including one connection
and a corresponding thread from activemq) and that finally prevented the
shutdown.

The BTMLifecycleListener listens to Lifecycle.START_EVENT and
Lifecycle.STOP_EVENT but I think that it should better listen to
Lifecycle.BEFORE_START_EVENT and Lifecycle.AFTER_STOP_EVENT.

I tried this with my own implementation of a LifecycleListener and now
everything works super fine. :-)

Cheers
Thomas Beckmann

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: BTMLifecycleListener shutting down too early

Ludovic Orban
Administrator
Hi,

Thanks for the report and the fix. I've created a JIRA entry to make sure this will be fixed in the next version: http://jira.codehaus.org/browse/BTM-37

Thanks again,
Ludovic