I have ThreadPoolExecutor whith next params:
corePoolSize = 20
maximumPoolSize = 100
workQueue = new LinkedBlockingQueue(10)
Each second I submit 1k tasks. Tasks represent some IO operation which takes 1-2s. Some of them get rejected. It's expected. I log the thread pool state before rejection using custom AbortPolicy.
In logs I see something I cannot explain. Messages like:
java.util.concurrent.ThreadPoolExecutor@3e6be2d8[Running, pool size = 100, active threads = 2, queued tasks = 10, completed tasks = 4471827].
I've found in docs that getActiveCount method Returns the approximate number of threads that are actively executing tasks. But it does not help me to understand...
What does "active threads" mean here? And why only 2 threads are active while pool has reached its limit, queue is full and the task is rejected?
I want to increase maximumPoolSize to process more tasks at once but firstly I need to understand whether I use ThreadPool resources efficiently.