class Concurrent::JavaExecutorService

@!macro abstract_executor_service_public_api @!visibility private

Constants

FALLBACK_POLICY_CLASSES

Public Instance Methods

kill() click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 46
def kill
  synchronize do
    @executor.shutdownNow
    nil
  end
end
post(*args, &task) click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 21
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
shutdown() click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 39
def shutdown
  synchronize do
    @executor.shutdown
    nil
  end
end
wait_for_termination(timeout = nil) click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 30
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

Private Instance Methods

ns_running?() click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 55
def ns_running?
  !(ns_shuttingdown? || ns_shutdown?)
end
ns_shutdown?() click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 67
def ns_shutdown?
  @executor.isShutdown || @executor.isTerminated
end
ns_shuttingdown?() click to toggle source
# File lib/concurrent-ruby/concurrent/executor/java_executor_service.rb, line 59
def ns_shuttingdown?
  if @executor.respond_to? :isTerminating
    @executor.isTerminating
  else
    false
  end
end