users@glassfish.java.net

MBeans at undeployment time

From: <forums_at_java.net>
Date: Sat, 3 Dec 2011 13:38:17 -0600 (CST)

 I have an MBean which is part of a war file. The application in that war
file creates threads at startup. I now want to make sure that all threads get
closed again when the application gets stopped/undeployed/redeployed. I am
looking for the best way to do this and I found a few ideas but I am not sure
if they work and which one would be best practice.

1. The MBean could be registered as a listener to JMX notifications, which
can easily be done with Spring. But does the glassfish container send out
notifications when undeploying an application (e.g. does glassfish unregister
mbeans and therefore send out an MBeanServerNotification?). Who sends out
that message, it it my own mbean? Can my mbean listen to an unregistering
event of itself? .... lots of questions maybe someone can help me out here.

2. LifeCycle Module: can my LifeCycle module be in the same application war
to which I want to listen to and intercept the undeployment command? How
would I do that?

3. Any other easy options?

 

Thanks


--
[Message sent by forum member 'jrox']
View Post: http://forums.java.net/node/870733