Menu

#2 incorrect thread pool configuration

open
nobody
None
5
2011-07-07
2011-07-07
No

In ZabbixAgent, you have,

final ExecutorService handlers = new ThreadPoolExecutor(1, 5, 60L,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());

If you look closely at the docs for ThreadPoolExecutor, maximumPoolSize has no effect if the queue is unbounded (as is the case here), this means the thread pool is effectively single threaded. The relevant line from the javadocs is,

"If there are more than corePoolSize but less than maximumPoolSize threads running, a new thread will be created only if the queue is full."

Discussion


Log in to post a comment.