Reputation: 157
I have a FixedThreadPool which has 1 slot for thread execution. Is it possible that, if a thread is occupying the slot and throws a non-catched exception, this slot keeps used forever, and the thread executor is not able to execute any new thread?
Upvotes: 1
Views: 183
Reputation: 69339
No, that's not possible. From the documentation of ExecutorService.newFixedThreadPool(int nThreads)
:
If any thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks.
Upvotes: 2