Skip to content

Fixed JavaThreadPoolExecutor queue bug when minimum pool size is zero. #195

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

Merged
merged 1 commit into from
Nov 26, 2014

Conversation

jdantonio
Copy link
Member

Fixes #182

The constructor was based on introspection of Java objects. Specifically this code:

pool = java.util.concurrent.Executors.newCachedThreadPool #=>  <Java::JavaUtilConcurrent::ThreadPoolExecutor:0x3d36e4cd>
pool.queue #=> #<Java::JavaUtilConcurrent::SynchronousQueue:0x525b461a>

I copied this behavior without reading the documentation of SynchronousQueue. In retrospect, it is clear that a synchronous queue, which always blocks and has a fixed size of zero, is not the behavior we want.

@jdantonio jdantonio force-pushed the bug/java-thread-pool branch from f67fb4a to aa9b695 Compare November 26, 2014 17:44
jdantonio added a commit that referenced this pull request Nov 26, 2014
Fixed JavaThreadPoolExecutor queue bug when minimum pool size is zero.
@jdantonio jdantonio merged commit 08f6c4f into master Nov 26, 2014
@jdantonio jdantonio deleted the bug/java-thread-pool branch November 26, 2014 17:44
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.

JavaThreadPoolExecutor have bounded queue for min_threads = 0
1 participant