We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f4ea4f0 + 8de2745 commit 140faa9Copy full SHA for 140faa9
lib/concurrent/executor/executor.rb
@@ -208,17 +208,19 @@ def kill_execution
208
209
module JavaExecutor
210
include Executor
211
+ java_import 'java.lang.Runnable'
212
213
# @!macro executor_method_post
214
def post(*args)
215
raise ArgumentError.new('no block given') unless block_given?
216
if running?
- @executor.submit{ yield(*args) }
217
+ executor_submit = @executor.java_method(:submit, [Runnable.java_class])
218
+ executor_submit.call { yield(*args) }
219
true
220
else
221
false
222
end
- rescue Java::JavaUtilConcurrent::RejectedExecutionException => ex
223
+ rescue Java::JavaUtilConcurrent::RejectedExecutionException
224
raise RejectedExecutionError
225
226
0 commit comments