Skip to content

Commit 34f487b

Browse files
Remove java_alias of 'submit' method of Runnable
There is an error while accessing the method of private class 'DelegatedExecutorService' in 'Executors' from 'JavaSingleThreadExecutor'. This happens for JDK-11, but works fine in JDK-8.
1 parent 619da05 commit 34f487b

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lib/concurrent/executor/java_executor_service.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ class JavaExecutorService < AbstractExecutorService
2020

2121
def initialize(*args, &block)
2222
super
23-
ns_make_executor_runnable
2423
end
2524

2625
def post(*args, &task)
2726
raise ArgumentError.new('no block given') unless block_given?
2827
return handle_fallback(*args, &task) unless running?
29-
@executor.submit_runnable Job.new(args, task)
28+
@executor.submit Job.new(args, task)
3029
true
3130
rescue Java::JavaUtilConcurrent::RejectedExecutionException
3231
raise RejectedExecutionError
@@ -75,14 +74,6 @@ def ns_shutdown?
7574
@executor.isShutdown || @executor.isTerminated
7675
end
7776

78-
def ns_make_executor_runnable
79-
if !defined?(@executor.submit_runnable)
80-
@executor.class.class_eval do
81-
java_alias :submit_runnable, :submit, [java.lang.Runnable.java_class]
82-
end
83-
end
84-
end
85-
8677
class Job
8778
include Runnable
8879
def initialize(args, block)

0 commit comments

Comments
 (0)