Executorshard3-5 years
Explain ThreadPoolExecutor's parameters and how a task moves through them.
A new task goes to a core thread if one is free, otherwise into the queue; only when the queue is full does the pool grow towards maximum; only when both are full does the rejection handler run. With an unbounded queue, maximum is never reached and nothing is ever rejected — until the heap is gone.
PreviousWhy would you choose ReentrantLock over synchronized?Next thenApply vs thenCompose — and which thread runs the callback?