-
1. Re: ExecutorService.newFixedThreadPool() - Possible thread leak?
pacionet Oct 27, 2016 6:01 AM (in response to pacionet)Probably it's a false problem.
I tried a load test with 600 task executed by 10 thread and I had no problems.
-
2. Re: ExecutorService.newFixedThreadPool() - Possible thread leak?
jaikiran Oct 27, 2016 8:52 AM (in response to pacionet)I don't see any WildFly or Java EE constructs in this code, so the behaviour/semantic should be exactly like what the javadoc of Executors#newFixedThreadPool dictates.
Mario Rossi wrote:
The statement executor.shutdown() seems not to kill the threads .
Can you get a thread dump and point us to the threads that you think are still running and not killed?
-
3. Re: ExecutorService.newFixedThreadPool() - Possible thread leak?
dmlloyd Oct 27, 2016 8:57 AM (in response to jaikiran)Also I'd like to add that using a spin loop to wait for the executor shutdown is probably a bad idea; there is an awaitTermination method which is probably better.
Finally it's likely better to share a single thread pool over the life of the application than to create a new one on every request. Java EE 7 has a facility for using thread pools safely from a Java EE application.