class Concurrent::FixedThreadPool

@!macro thread_pool_options
The API and behavior of this class are based on Java’s ‘FixedThreadPool`
from the pool and replaced.
Should a thread crash for any reason the thread will immediately be removed
tasks `#post` to the thread pool are enqueued until a thread becomes available.
At any point, at most `num_threads` will be active processing tasks. When all threads are busy new
A thread pool that reuses a fixed number of threads operating off an unbounded queue.
@!macro fixed_thread_pool

def initialize(num_threads, opts = {})

Other tags:
    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