简体   繁体   中英

How to stop a java class when undeploying a mule application

My Mule application uses a java class which is started as a Spring Bean. This works fine. But I have a problem when I undeploy my application and deploy a newer version.

After I undeploy the application the java process is still active. After deploying the new version of the application, there are two instances of the java class running.

As a solution I have added a shutdown hook to the java class. The hook works, but only when I shutdown Mule itself. Not when I undeploy the app.

To test this I have done the following:

  • Deploy application and undeploy it.
  • Check in log for message of shutdown java process, nothing found.
  • Deploy the application again.
  • Stop Mule and check log. Now there are two entries about the shutdown of the java process.

What should I do to stop the java process when I undeploy the application?

Thanks, Jeroen

I am using Mule 3.4.0 and jdk1.7.0_25.

在你的类上添加一个stop方法,并通过Spring的destroy-method调用它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM