Skip to content

Commit aa9b695

Browse files
committed
Fixed JavaThreadPoolExecutor queue bug when minimum pool size is zero.
1 parent 3ca7580 commit aa9b695

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Please see the [roadmap](https://github.com/ruby-concurrency/concurrent-ruby/iss
1515
* Added missing synchronizations to `TimerSet`
1616
* Fixed bug with return value of `Concurrent::Actor::Utils::Pool#ask`
1717
* Fixed timing bug in `TimerTask`
18+
* Fixed bug when creating a `JavaThreadPoolExecutor` with minimum pool size of zero
1819
* Removed confusing warning when not using native extenstions
1920
* Improved documentation
2021

lib/concurrent/executor/java_thread_pool_executor.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ def initialize(opts = {})
7474
raise ArgumentError.new('min_threads cannot be more than max_threads') if min_length > max_length
7575
raise ArgumentError.new("#{@overflow_policy} is not a valid overflow policy") unless OVERFLOW_POLICIES.keys.include?(@overflow_policy)
7676

77-
if min_length == 0 && @max_queue == 0
78-
queue = java.util.concurrent.SynchronousQueue.new
79-
elsif @max_queue == 0
77+
if @max_queue == 0
8078
queue = java.util.concurrent.LinkedBlockingQueue.new
8179
else
8280
queue = java.util.concurrent.LinkedBlockingQueue.new(@max_queue)
@@ -90,7 +88,7 @@ def initialize(opts = {})
9088
set_shutdown_hook
9189
end
9290

93-
# @!macro executor_module_method_can_overflow_question
91+
# @!macro executor_module_method_can_overflow_question
9492
def can_overflow?
9593
@max_queue != 0
9694
end

0 commit comments

Comments
 (0)