public void despawnWorkers() { for (int i = 0; i < workerThreadGroup.length; i++) { ThreadGroup group = workerThreadGroup[i]; Thread[] threads = new Thread[group.activeCount()]; group.enumerate(threads); for (Thread t : threads) { System.out.println("[Server]: \t\t" + t.getName() + " despawned"); ((WorkerThread) t).shutdown(); } group.destroy(); } }