Relative Content

Tag Archive for javamultithreadingexecutorservice

ExecutorService did not return finished Threads back to pool?

i have created an async Task-Thread which creates inside with “Executors.newFixedThreadPool(8)” 8-Worker-Threads for long running jobs. Lets say i have 8 long running jobs, all works fine. All 8 Worker-Jobs complete in for example 10seconds. The Problem is now, if i set the FixedThreadPoolSize to 7 (One Thread less than my amount of Jobs) and i get again my 8 Jobs. It took not round about 10 seconds, it took nearly 70seconds. But why is this so? It looks like there are no more threads available from the pool. But the 7 Threads before are done. And for the last Thread he took 60seconds.