If you want your application to exit, although you still have threads, you have to mark the thread as a daemon thread:
Thread t = new Thread (myRunnable);
t.setDaemon (true),
t.start ();
This is especially important when you do this on the application server, otherwise the server cannot be disconnected!
If you repeat this, you can think of ThreadPool to make it more efficient.
a_horse_with_no_name
source share