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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -