public static void shutdownWorkerThreads() throws InterruptedException { ThreadGroup group = Thread.currentThread().getThreadGroup(); Thread[] threads = new Thread[group.activeCount()]; group.enumerate( threads ); for ( Thread thread : threads ) { if ( thread.getName().contains( NAME_PREFIX ) ) { thread.interrupt(); thread.stop(); } } verifyNoWorkerThreadsLeft(); }
public static void shutdownWorkerThreads() throws InterruptedException { ThreadGroup group = Thread.currentThread().getThreadGroup(); Thread[] threads = new Thread[group.activeCount()]; group.enumerate( threads ); for ( Thread thread : threads ) { if ( thread.getName().contains( NAME_PREFIX ) ) { thread.interrupt(); thread.stop(); } } verifyNoWorkerThreadsLeft(); }