class Concurrent::AbstractExecutorService

@!visibility private
@!macro abstract_executor_service_public_api

def auto_terminate=(value)

@!macro executor_service_method_auto_terminate_setter
def auto_terminate=(value)
  synchronize { self.ns_auto_terminate = value }
end

def auto_terminate?

@!macro executor_service_method_auto_terminate_question
def auto_terminate?
  synchronize { ns_auto_terminate? }
end

def handle_fallback(*args)

Parameters:
  • args (Array) -- the arguments to the task which is being handled.
def handle_fallback(*args)
  case fallback_policy
  when :abort
    raise RejectedExecutionError
  when :discard
    false
  when :caller_runs
    begin
      yield(*args)
    rescue => ex
      # let it fail
      log DEBUG, ex
    end
    true
  else
    fail "Unknown fallback policy #{fallback_policy}"
  end
end

def initialize(*args, &block)

Create a new thread pool.
def initialize(*args, &block)
  super(&nil)
  synchronize { ns_initialize(*args, &block) }
end

def kill

@!macro executor_service_method_kill
def kill
  raise NotImplementedError
end

def ns_auto_terminate=(value)

def ns_auto_terminate=(value)
  case value
  when true
    AtExit.add(self) { terminate_at_exit }
    @auto_terminate = true
  when false
    AtExit.delete(self)
    @auto_terminate = false
  else
    raise ArgumentError
  end
end

def ns_auto_terminate?

def ns_auto_terminate?
  !!@auto_terminate
end

def ns_execute(*args, &task)

def ns_execute(*args, &task)
  raise NotImplementedError
end

def ns_kill_execution

The default behavior is to do nothing.
Callback method called when the executor has been killed.

@!macro executor_service_method_ns_kill_execution
def ns_kill_execution
  # do nothing
end

def ns_shutdown_execution

The default behavior is to signal all waiting threads.
Callback method called when an orderly shutdown has completed.

@!macro executor_service_method_ns_shutdown_execution
def ns_shutdown_execution
  # do nothing
end

def running?

@!macro executor_service_method_running_question
def running?
  synchronize { ns_running? }
end

def shutdown

@!macro executor_service_method_shutdown
def shutdown
  raise NotImplementedError
end

def shutdown?

@!macro executor_service_method_shutdown_question
def shutdown?
  synchronize { ns_shutdown? }
end

def shuttingdown?

@!macro executor_service_method_shuttingdown_question
def shuttingdown?
  synchronize { ns_shuttingdown? }
end

def terminate_at_exit

def terminate_at_exit
  kill # TODO be gentle first
  wait_for_termination(10)
end

def wait_for_termination(timeout = nil)

@!macro executor_service_method_wait_for_termination
def wait_for_termination(timeout = nil)
  raise NotImplementedError
end