Can't increase ThreadPoolExecutor's core pool size
I'm having issues dynamically increasing the core pool size of a ThreadPoolExecutor in kotlin.
First I define my ThreadPoolExecutor like this:
val POOL = Executors.newFixedThreadPool(20) as ThreadPoolExecutor
Then I add some tasks to the ThreadPoolExecutor.
After some time, in a different thread, while the tasks are still running:
POOL.corePoolSize += 20
It returns:
Exception in thread "Thread-0" java.lang.IllegalArgumentException
at...