How can I stop a running thread, when undeploying my application?
The problem is, that undeploying won't remove the thread I created when deploying the application. How can I be notified when the application will be undeployed?
Now I "solve" the problem with a dirty-workaround: when the application is deployed, it will remove all "old" threads with a specific name. I'm searching for a better solution.
Thanks for you help.
EJBs are not supposed to start new threads,
directly or otherwise. Only callouts to the container
should start new threads.
For MBeans, implement a management operation with the
e.g. for standard mbeans
public void stop()