You need to cleanup threads you create.
Thank you. Scott,
How to clean up?
I need to clean in the code, or set up in Jboss.
If you started the thread you need to stop it. What is the nature of the thread in question?
I use Singleton pattern for this thread. The thread is a commandManager, all different commands will go to the manager to be processed(command pattern). so there is a while loop to check if there are commands coming in the manager.
in my mind, I thougt, when hot deploy, Jboss automatically kills all runnig threads first, then loads a new .ear, but it doesn't look like this way.
I also did a simple test. after I started Jboss, and Jboss finished loading. the commandmanager was running. then I deleted the .ear. I found the thread was still running.
Please help. Thank you.
You shouldn't use singletons, which is usually bad design. Create ServiceMBeans and in your stopService() shut down your thread.