We have a scenario where tasks submitted to ThreadPoolExecutor are long running. When the thread pool is started we start it with core pool size = 5, max pool size = 20 and queu
The overall situation is like this:
core pool size = 5,
max pool size = 20 and
queue size of 10
10 tasks are submitted. Out of which
Hence, Your Program is hanged .
To know more about dynamics of ThreadPoolExecutor
watch here . The notable points of this doc is as follows:
EDIT
If you wish to increase core pool size then you can use setCorePoolSize(int corePoolSize) . If you increase the corepoolsize
then new threads will, if needed, be started to execute any queued tasks.