Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default HttpClient callback thread pool is always one #157

Merged
merged 1 commit into from Aug 10, 2014

Conversation

dlebrero
Copy link
Contributor

Changing the default corePoolSize to the number of available
processors.

The default thead pool for running the http client async callbacks is
initialized with a coreSize of 0 and a unbounded queue. The
ThreadPoolExecutor creates threads just if all the coreSize threads are
busy and the queue is full. Given that the default queue is unbounded,
new threads are never created, hence the default-pool will never ever
have more than 1 thread to execute all the callbacks.

From the ThreadPoolExecutor doc (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html):

"Using an unbounded queue (for example a LinkedBlockingQueue without a predefined capacity) will cause new tasks to wait in the queue when all corePoolSize threads are busy. Thus, no more than corePoolSize threads will ever be created"

Changing the default corePoolSize to the number of available
processors.

The default thead pool for running the http client async callbacks is
initialized with a coreSize of 0 and a unbounded queue. The
ThreadPoolExecutor creates threads just if all the coreSize threads are
busy and the queue is full. Given that the default queue is unbounded,
new threads are never created, hence the default-pool will never ever
have more than 1 thread to execute all the callbacks.

From the ThreadPoolExecutor doc (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html):

"Using an unbounded queue (for example a LinkedBlockingQueue without a predefined capacity) will cause new tasks to wait in the queue when all corePoolSize threads are busy. Thus, no more than corePoolSize threads will ever be created"
shenfeng added a commit that referenced this pull request Aug 10, 2014
Default HttpClient callback thread pool is always one
@shenfeng shenfeng merged commit 6d99f19 into http-kit:master Aug 10, 2014
@shenfeng
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants