Files

Class/Module Index [+]

Quicksearch

Concurrent::JavaExecutorService

@!macro abstract_executor_service_public_api @!visibility private

Public Class Methods

new(*args, &block) click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 442
def initialize(*args, &block)
  super
  ns_make_executor_runnable
end

Public Instance Methods

kill() click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 473
def kill
  synchronize do
    self.ns_auto_terminate = false
    @executor.shutdownNow
    nil
  end
end
post(*args, &task) click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 447
def post(*args, &task)
  raise ArgumentError.new('no block given') unless block_given?
  return handle_fallback(*args, &task) unless running?
  @executor.submit_runnable Job.new(args, task)
  true
rescue Java::JavaUtilConcurrent::RejectedExecutionException
  raise RejectedExecutionError
end
shutdown() click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 465
def shutdown
  synchronize do
    self.ns_auto_terminate = false
    @executor.shutdown
    nil
  end
end
wait_for_termination(timeout = nil) click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 456
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

Protected Instance Methods

ns_make_executor_runnable() click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 499
def ns_make_executor_runnable
  if !defined?(@executor.submit_runnable)
    @executor.class.class_eval do
      java_alias :submit_runnable, :submit, [java.lang.Runnable.java_class]
    end
  end
end
ns_running?() click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 483
def ns_running?
  !(ns_shuttingdown? || ns_shutdown?)
end
ns_shutdown?() click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 495
def ns_shutdown?
  @executor.isShutdown || @executor.isTerminated
end
ns_shuttingdown?() click to toggle source
# File lib/concurrent/executor/executor_service.rb, line 487
def ns_shuttingdown?
  if @executor.respond_to? :isTerminating
    @executor.isTerminating
  else
    false
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.