Method: Concurrent::ThreadPoolExecutor#max_queue

Defined in:
lib/concurrent-ruby/concurrent/executor/thread_pool_executor.rb

#max_queueInteger (readonly)

The maximum number of tasks that may be waiting in the work queue at any one time. When the queue size reaches ‘max_queue` subsequent tasks will be rejected in accordance with the configured `fallback_policy`.

Returns:

  • (Integer)

    The maximum number of tasks that may be waiting in the work queue at any one time. When the queue size reaches ‘max_queue` subsequent tasks will be rejected in accordance with the configured `fallback_policy`.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/concurrent-ruby/concurrent/executor/thread_pool_executor.rb', line 56

class ThreadPoolExecutor < ThreadPoolExecutorImplementation

  # @!macro thread_pool_executor_method_initialize
  #
  #   Create a new thread pool.
  #
  #   @param [Hash] opts the options which configure the thread pool.
  #
  #   @option opts [Integer] :max_threads (DEFAULT_MAX_POOL_SIZE) the maximum
  #     number of threads to be created
  #   @option opts [Integer] :min_threads (DEFAULT_MIN_POOL_SIZE) When a new task is submitted
  #      and fewer than `min_threads` are running, a new thread is created
  #   @option opts [Integer] :idletime (DEFAULT_THREAD_IDLETIMEOUT) the maximum
  #     number of seconds a thread may be idle before being reclaimed
  #   @option opts [Integer] :max_queue (DEFAULT_MAX_QUEUE_SIZE) the maximum
  #     number of tasks allowed in the work queue at any one time; a value of
  #     zero means the queue may grow without bound
  #   @option opts [Symbol] :fallback_policy (:abort) the policy for handling new
  #     tasks that are received when the queue size has reached
  #     `max_queue` or the executor has shut down
  #   @option opts [Boolean] :synchronous (DEFAULT_SYNCHRONOUS) whether or not a value of 0
  #     for :max_queue means the queue must perform direct hand-off rather than unbounded.
  #   @raise [ArgumentError] if `:max_threads` is less than one
  #   @raise [ArgumentError] if `:min_threads` is less than zero
  #   @raise [ArgumentError] if `:fallback_policy` is not one of the values specified
  #     in `FALLBACK_POLICIES`
  #
  #   @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html

  # @!method initialize(opts = {})
  #   @!macro thread_pool_executor_method_initialize
end