Class: Concurrent::JavaExecutorService
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Concurrent::AbstractExecutorService
|
Defined in: | lib/concurrent-ruby/concurrent/executor/java_executor_service.rb |
Constant Summary
-
FALLBACK_POLICY_CLASSES =
private
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 14{ abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze
Concern::Logging
- Included
AbstractExecutorService
- Inherited
Class Method Summary
AbstractExecutorService
- Inherited
.new | Create a new thread pool. |
Instance Attribute Summary
- #fallback_policy ⇒ Symbol readonly
- #ns_running? ⇒ Boolean readonly private
- #ns_shutdown? ⇒ Boolean readonly private
- #ns_shuttingdown? ⇒ Boolean readonly private
AbstractExecutorService
- Inherited
#auto_terminate= |
|
#auto_terminate? | Is the executor auto-terminate when the application exits? |
#fallback_policy, #name, | |
#running? | Is the executor running? |
#shutdown | Begin an orderly shutdown. |
#shutdown? | Is the executor shutdown? |
#shuttingdown? | Is the executor shuttingdown? |
#ns_auto_terminate? |
ExecutorService
- Included
#can_overflow? | Does the task queue have a maximum size? |
#serialized? | Does this executor guarantee serialization of its operations? |
Instance Method Summary
-
#<<(task) ⇒ self
Submit a task to the executor for asynchronous processing.
-
#auto_terminate=(value) ⇒ Boolean
deprecated
Deprecated.
Has no effect
-
#auto_terminate? ⇒ Boolean
Is the executor auto-terminate when the application exits?
-
#can_overflow? ⇒ Boolean
Does the task queue have a maximum size?
-
#kill
Begin an immediate shutdown.
-
#post(*args) { ... } ⇒ Boolean
Submit a task to the executor for asynchronous processing.
-
#running? ⇒ Boolean
Is the executor running?
-
#serialized? ⇒ Boolean
Does this executor guarantee serialization of its operations?
-
#shutdown
Begin an orderly shutdown.
-
#shutdown? ⇒ Boolean
Is the executor shutdown?
-
#shuttingdown? ⇒ Boolean
Is the executor shuttingdown?
-
#wait_for_termination(timeout = nil) ⇒ Boolean
Block until executor shutdown is complete or until
timeout
seconds have passed.
AbstractExecutorService
- Inherited
#<< | Submit a task to the executor for asynchronous processing. |
#can_overflow? | Does the task queue have a maximum size? |
#kill | Begin an immediate shutdown. |
#post | Submit a task to the executor for asynchronous processing. |
#serialized? | Does this executor guarantee serialization of its operations? |
#to_s, | |
#wait_for_termination | Block until executor shutdown is complete or until |
#fallback_action | Returns an action which executes the #fallback_policy once the queue size reaches |
#ns_execute, | |
#ns_kill_execution | Callback method called when the executor has been killed. |
#ns_shutdown_execution | Callback method called when an orderly shutdown has completed. |
Concern::Deprecation
- Included
ExecutorService
- Included
#<< | Submit a task to the executor for asynchronous processing. |
#post | Submit a task to the executor for asynchronous processing. |
Concern::Logging
- Included
#log | Logs through global_logger, it can be overridden by setting @logger. |
Synchronization::LockableObject
- Inherited
Constructor Details
This class inherits a constructor from Concurrent::AbstractExecutorService
Instance Attribute Details
#fallback_policy ⇒ Symbol
(readonly)
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#ns_running? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 55
def ns_running? !(ns_shuttingdown? || ns_shutdown?) end
#ns_shutdown? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 63
def ns_shutdown? @executor.isTerminated end
#ns_shuttingdown? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 59
def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end
Instance Method Details
#<<(task) ⇒ self
Submit a task to the executor for asynchronous processing.
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#auto_terminate=(value) ⇒ Boolean
Has no effect
Set
the auto-terminate behavior for this executor.
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#auto_terminate? ⇒ Boolean
Is the executor auto-terminate when the application exits?
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#can_overflow? ⇒ Boolean
Does the task queue have a maximum size?
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#kill
Begin an immediate shutdown. In-progress tasks will be allowed to complete but enqueued tasks will be dismissed and no new tasks will be accepted. Has no additional effect if the thread pool is not running.
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 46
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#post(*args) { ... } ⇒ Boolean
Submit a task to the executor for asynchronous processing.
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 21
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#running? ⇒ Boolean
Is the executor running?
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#serialized? ⇒ Boolean
Does this executor guarantee serialization of its operations?
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#shutdown
Begin an orderly shutdown. Tasks already in the queue will be executed, but no new tasks will be accepted. Has no additional effect if the thread pool is not running.
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 39
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#shutdown? ⇒ Boolean
Is the executor shutdown?
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#shuttingdown? ⇒ Boolean
Is the executor shuttingdown?
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 11
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end
#wait_for_termination(timeout = nil) ⇒ Boolean
# File 'lib/concurrent-ruby/concurrent/executor/java_executor_service.rb', line 30
class JavaExecutorService < AbstractExecutorService java_import 'java.lang.Runnable' FALLBACK_POLICY_CLASSES = { abort: java.util.concurrent.ThreadPoolExecutor::AbortPolicy, discard: java.util.concurrent.ThreadPoolExecutor::DiscardPolicy, caller_runs: java.util.concurrent.ThreadPoolExecutor::CallerRunsPolicy }.freeze private_constant :FALLBACK_POLICY_CLASSES def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return fallback_action(*args, &task).call unless running? @executor.submit Job.new(args, task) true rescue Java::JavaUtilConcurrent::RejectedExecutionException raise RejectedExecutionError end def wait_for_termination(timeout = nil) if timeout.nil? ok = @executor.awaitTermination(60, java.util.concurrent.TimeUnit::SECONDS) until ok true else @executor.awaitTermination(1000 * timeout, java.util.concurrent.TimeUnit::MILLISECONDS) end end def shutdown synchronize do @executor.shutdown nil end end def kill synchronize do @executor.shutdownNow nil end end private def ns_running? !(ns_shuttingdown? || ns_shutdown?) end def ns_shuttingdown? @executor.isShutdown && !@executor.isTerminated end def ns_shutdown? @executor.isTerminated end class Job include Runnable def initialize(args, block) @args = args @block = block end def run @block.call(*@args) end end private_constant :Job end