class Concurrent::FixedThreadPool
def initialize(num_threads, opts = {})
- See: http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool-int- -
Raises:
-
(ArgumentError)
- if `fallback_policy` is not a known policy -
(ArgumentError)
- if `num_threads` is less than or equal to zero
Options Hash:
(**opts)
-
:fallback_policy
(Symbol
) -- the fallback policy
Parameters:
-
opts
(Hash
) -- the options defining pool behavior. -
num_threads
(Integer
) -- the number of threads to allocate
def initialize(num_threads, opts = {}) raise ArgumentError.new('number of threads must be greater than zero') if num_threads.to_i < 1 defaults = { max_queue: DEFAULT_MAX_QUEUE_SIZE, idletime: DEFAULT_THREAD_IDLETIMEOUT } overrides = { min_threads: num_threads, max_threads: num_threads } super(defaults.merge(opts).merge(overrides)) end