File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -250,8 +250,13 @@ def shutdown?
250
250
end
251
251
252
252
# @!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
255
260
end
256
261
257
262
# @!macro executor_method_shutdown
Original file line number Diff line number Diff line change 178
178
expect ( subject . wait_for_termination ( 0 ) ) . to be_falsey
179
179
end
180
180
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
181
188
end
182
189
end
You can’t perform that action at this time.
0 commit comments