class Concurrent::JavaCachedThreadPool

@!macro cached_thread_pool

def initialize(opts = {})

Other tags:
    See: http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool-- -

Raises:
  • (ArgumentError) - if `overflow_policy` is not a known policy

Options Hash: (**opts)
  • :overflow_policy (Symbol) -- the overflow policy

Parameters:
  • opts (Hash) -- the options defining pool behavior.
def initialize(opts = {})
  @overflow_policy = opts.fetch(:overflow_policy, :abort)
  @max_queue = 0
  raise ArgumentError.new("#{@overflow_policy} is not a valid overflow policy") unless OVERFLOW_POLICIES.keys.include?(@overflow_policy)
  @executor = java.util.concurrent.Executors.newCachedThreadPool
  @executor.setRejectedExecutionHandler(OVERFLOW_POLICIES[@overflow_policy].new)
  set_shutdown_hook
end