class Concurrent::Configuration

A gem-level configuration object.

def global_operation_pool

Returns:
  • (ThreadPoolExecutor) - the thread pool
def global_operation_pool
  @global_operation_pool ||= Concurrent::ThreadPoolExecutor.new(
    min_threads: [2, @cores].max,
    max_threads: [2, @cores].max,
    idletime: 10 * 60,                  # 10 minutes
    max_queue: [20, @cores * 15].max,
    overflow_policy: :abort             # raise an exception
  )
end

def global_operation_pool=(executor)

Raises:
  • (ConfigurationError) - if this thread pool has already been set

Returns:
  • (ThreadPoolExecutor) - the new thread pool

Parameters:
  • executor (Executor) -- the executor to be used for this thread pool
def global_operation_pool=(executor)
  raise ConfigurationError.new('global operation pool was already set') unless @global_operation_pool.nil?
  @global_operation_pool = executor
end

def global_task_pool

Returns:
  • (ThreadPoolExecutor) - the thread pool
def global_task_pool
  @global_task_pool ||= Concurrent::ThreadPoolExecutor.new(
    min_threads: [2, @cores].max,
    max_threads: [20, @cores * 15].max,
    idletime: 2 * 60,                   # 2 minutes
    max_queue: 0,                       # unlimited
    overflow_policy: :abort             # raise an exception
  )
end

def global_task_pool=(executor)

Raises:
  • (ConfigurationError) - if this thread pool has already been set

Returns:
  • (ThreadPoolExecutor) - the new thread pool

Parameters:
  • executor (Executor) -- the executor to be used for this thread pool
def global_task_pool=(executor)
  raise ConfigurationError.new('global task pool was already set') unless @global_task_pool.nil?
  @global_task_pool = executor
end

def global_timer_set

Other tags:
    See: Concurrent::timer -

Returns:
  • (ThreadPoolExecutor) - the thread pool
def global_timer_set
  @global_timer_set ||= Concurrent::TimerSet.new
end

def initialize

Create a new configuration object.
def initialize
  @cores ||= Concurrent::processor_count
end