java - concurrency - How to make it queue and not reject? -


using answer given user sjlee here impossible make cached thread pool size limit?

with code

new threadpoolexecutor(100, // core size     10000, // max size     1000, // idle timeout     timeunit.milliseconds,     new linkedblockingqueue<runnable>(integer.max_size)); // queue size 

if there more coresize 100 * queuesize 20 tasks, number of thread increase until hits max size.

ok.

but problem is, lets everything's done , there no more tasks, number of threads not decrease.

how make executor reduce number of threads 0 when they're idling?

next, how make executor queue extras run later?

you can use allowcorethreadtimeout(true) core-thread terminate when timeout.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -