File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -250,8 +250,13 @@ def shutdown?
250250 end
251251
252252 # @!macro executor_method_wait_for_termination
253- def wait_for_termination ( timeout )
254- @executor . awaitTermination ( 1000 * timeout , java . util . concurrent . TimeUnit ::MILLISECONDS )
253+ def wait_for_termination ( timeout = nil )
254+ if timeout . nil?
255+ ok = @executor . awaitTermination ( 60 , java . util . concurrent . TimeUnit ::SECONDS ) until ok
256+ true
257+ else
258+ @executor . awaitTermination ( 1000 * timeout , java . util . concurrent . TimeUnit ::MILLISECONDS )
259+ end
255260 end
256261
257262 # @!macro executor_method_shutdown
Original file line number Diff line number Diff line change 178178 expect ( subject . wait_for_termination ( 0 ) ) . to be_falsey
179179 end
180180 end
181+
182+ it 'waits forever when no timeout value is given' do
183+ subject . post { sleep ( 0.5 ) }
184+ sleep ( 0.1 )
185+ subject . shutdown
186+ expect ( subject . wait_for_termination ) . to be_truthy
187+ end
181188 end
182189end
You can’t perform that action at this time.
0 commit comments