Sha256: 4eb4f14e0cb95b38a5c442476f9880bf58fb4a2f1f693277262a9cc1e7cc94ad

Contents?: true

Size: 903 Bytes

Versions: 30

Compression:

Stored size: 903 Bytes

Contents

require 'concurrent/executor/ruby_thread_pool_executor'

module Concurrent

  # @!macro cached_thread_pool
  class RubyCachedThreadPool < RubyThreadPoolExecutor

    # Create a new thread pool.
    #
    # @param [Hash] opts the options defining pool behavior.
    #   number of seconds a thread may be idle before it is reclaimed
    #
    # @raise [ArgumentError] if `overflow_policy` is not a known policy
    def initialize(opts = {})
      overflow_policy = opts.fetch(:overflow_policy, :abort)

      raise ArgumentError.new("#{overflow_policy} is not a valid overflow policy") unless OVERFLOW_POLICIES.include?(overflow_policy)

      opts = opts.merge(
        min_threads: 0,
        max_threads: DEFAULT_MAX_POOL_SIZE,
        overflow_policy: overflow_policy,
        max_queue: DEFAULT_MAX_QUEUE_SIZE,
        idletime: DEFAULT_THREAD_IDLETIMEOUT
      )
      super(opts)
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
concurrent-ruby-0.7.1 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.1-x86_64-linux lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.1-x86-solaris-2.11 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.1-x86-mingw32 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.1-x86-linux lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.1-x64-mingw32 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.1-java lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0-x86_64-linux lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0-x86-solaris-2.11 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0-x86-mingw32 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0-x86-linux lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0-x64-mingw32 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0-java lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0.rc2 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0.rc2-x86_64-linux lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0.rc2-x86_64-darwin-13 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0.rc2-x86-solaris-2.11 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0.rc2-x86-mingw32 lib/concurrent/executor/ruby_cached_thread_pool.rb
concurrent-ruby-0.7.0.rc2-x86-linux lib/concurrent/executor/ruby_cached_thread_pool.rb