Program does not terminate immediately when all ExecutorService tasks are done
问题 I put a bunch of runnable objects into an ExecutorService: // simplified content of main method ExecutorService threadPool = Executors.newCachedThreadPool(); for(int i = 0; i < workerCount; i++) { threadPool.execute(new Worker()); } I would expect my program/process to stop immediately after all workers are done. But according to my log, it takes another 20-30 seconds until that happens. The workers do not allocate any resources, in fact, they do nothing at the moment. Don't get me wrong,