You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by hgilliam-scholastic <HG...@scholastic.com> on 2012/02/02 16:32:01 UTC

ServiceMix 3.3.0 - How can a JBI service unit detect when its being shutdown so it can free resources?

I have a service unit that uses an ehcache disk-persistent cache.  Right now
there is no replication occurring but that will be added later.  I am using
ServiceMix 3.4.0 running on CentOS 5.7.

I am running ServiceMix in HA mode and test the HA switchover by shutting
down the first instance of SeriveMix, the second instance comes up but I get
an error in the service unit when it tries to access the cache.  I have
figured out that this is because the CacheManager running in the first SM
instance was not shutdown cleanly.

Looking through ehcache's docs they say that I could shutdown the
CacheManager in my class's finalize method but they do not recommend this
method.

I could not find in the SM docs or online any way for a service unit to
detect when it is about to be shutdown so that it can do cleanup tasks like
freeing resources and cleanly shutting down connections.

What is the "proper" way to implement this for SM service units ?

--
View this message in context: http://servicemix.396122.n5.nabble.com/ServiceMix-3-3-0-How-can-a-JBI-service-unit-detect-when-its-being-shutdown-so-it-can-free-resources-tp5451037p5451037.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.