Skip to content

Commit 140faa9

Browse files
committed
Merge pull request #127 from maximchick/master
warning: ambiguous Java methods found
2 parents f4ea4f0 + 8de2745 commit 140faa9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/concurrent/executor/executor.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,19 @@ def kill_execution
208208

209209
module JavaExecutor
210210
include Executor
211+
java_import 'java.lang.Runnable'
211212

212213
# @!macro executor_method_post
213214
def post(*args)
214215
raise ArgumentError.new('no block given') unless block_given?
215216
if running?
216-
@executor.submit{ yield(*args) }
217+
executor_submit = @executor.java_method(:submit, [Runnable.java_class])
218+
executor_submit.call { yield(*args) }
217219
true
218220
else
219221
false
220222
end
221-
rescue Java::JavaUtilConcurrent::RejectedExecutionException => ex
223+
rescue Java::JavaUtilConcurrent::RejectedExecutionException
222224
raise RejectedExecutionError
223225
end
224226

0 commit comments

Comments
 (0)