Class: JRuby::Executors
- Inherits:
-
Object
show all
- Defined in:
- lib/jruby/executors.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(executor_service) ⇒ Executors
Returns a new instance of Executors.
15
16
17
|
# File 'lib/jruby/executors.rb', line 15
def initialize(executor_service)
@executor_service = executor_service
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
19
20
21
|
# File 'lib/jruby/executors.rb', line 19
def method_missing(method_name, *args, &block)
@executor_service.send method_name, *args, &block
end
|
Class Method Details
.new_cached_thread_pool ⇒ Object
7
8
9
|
# File 'lib/jruby/executors.rb', line 7
def self.new_cached_thread_pool
new(JavaExecutors.newCachedThreadPool)
end
|
.new_fixed_thread_pool(n_threads) ⇒ Object
11
12
13
|
# File 'lib/jruby/executors.rb', line 11
def self.new_fixed_thread_pool(n_threads)
new(JavaExecutors.newFixedThreadPool(n_threads))
end
|
Instance Method Details
#submit(&block) ⇒ Object
23
24
25
|
# File 'lib/jruby/executors.rb', line 23
def submit(&block)
@executor_service.java_method(:submit, [Runnable.java_class]).call(&block)
end
|