Skip to content

Commit 70858f8

Browse files
committed
Remove deprecated status method
1 parent e05d498 commit 70858f8

File tree

4 files changed

+2
-28
lines changed

4 files changed

+2
-28
lines changed

lib/concurrent/executor/java_thread_pool_executor.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,6 @@ def remaining_capacity
149149
@max_queue == 0 ? -1 : @executor.getQueue.remainingCapacity
150150
end
151151

152-
# This method is deprecated and will be removed soon.
153-
# This method is supost to return the threads status, but Java API doesn't
154-
# provide a way to get the thread status. So we return an empty Array instead.
155-
def status
156-
warn '[DEPRECATED] `status` is deprecated and will be removed soon.'
157-
warn "Calls to `status` return an empty Array. Java ThreadPoolExecutor does not provide thread's status."
158-
[]
159-
end
160-
161152
# Is the thread pool running?
162153
#
163154
# @return [Boolean] `true` when running, `false` when shutting down or shutdown

lib/concurrent/executor/ruby_thread_pool_executor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def initialize(opts = {})
8989
@pool = [] # all workers
9090
@ready = [] # used as a stash (most idle worker is at the start)
9191
@queue = [] # used as queue
92+
# @ready or @queue is empty at all times
9293
@scheduled_task_count = 0
9394
@completed_task_count = 0
9495
@largest_length = 0
@@ -201,6 +202,7 @@ def ns_kill_execution
201202
# tries to assign task to a worker, tries to get one from @ready or to create new one
202203
# @return [true, false] if task is assigned to a worker
203204
def ns_assign_worker(*args, &task)
205+
# keep growing if the pool is not at the minimum yet
204206
worker = (@ready.pop if @pool.size >= @min_length) || ns_add_busy_worker
205207
if worker
206208
worker << [task, args]

spec/concurrent/executor/cached_thread_pool_shared.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,6 @@
9595
end
9696
end
9797

98-
context '#status' do
99-
100-
it 'returns an array' do
101-
skip 'not added' unless subject.respond_to? :status
102-
allow(subject).to receive(:warn)
103-
expect(subject.status).to be_kind_of(Array)
104-
end
105-
end
106-
10798
context '#idletime' do
10899

109100
subject{ described_class.new(idletime: 42) }

spec/concurrent/executor/fixed_thread_pool_shared.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,6 @@
145145
end
146146
end
147147

148-
context '#status' do
149-
150-
it 'returns an array' do
151-
skip 'not added' unless subject.respond_to? :status
152-
allow(subject).to receive(:warn)
153-
expect(subject.status).to be_kind_of(Array)
154-
end
155-
end
156-
157-
158148
context '#kill' do
159149

160150
it 'attempts to kill all in-progress tasks' do

0 commit comments

Comments
 (0)