module Garcon::Executor

Attributes

fallback_policy[R]

The policy defining how rejected tasks (tasks received once the queue size reaches the configured ‘max_queue`, or after the executor has shut down) are handled. Must be one of the values specified in `FALLBACK_POLICY`.

Public Instance Methods

auto_terminate?() click to toggle source
# File lib/garcon/task/executor.rb, line 79
def auto_terminate?
  !! @auto_terminate
end
can_overflow?() click to toggle source

Does the task queue have a maximum size?

@note Always returns ‘false`

@return [Boolean] True if the task queue has a maximum size else false.

@note Always returns ‘false`

# File lib/garcon/task/executor.rb, line 37
def can_overflow?
  false
end
handle_fallback(*args) { |*args| ... } click to toggle source

Handler which executes the ‘fallback_policy` once the queue size reaches `max_queue`.

@param [Array] args

The arguments to the task which is being handled.

@!visibility private

# File lib/garcon/task/executor.rb, line 48
def handle_fallback(*args)
  case @fallback_policy
  when :abort
    raise RejectedExecutionError
  when :discard
    false
  when :caller_runs
    begin
      yield(*args)
    rescue => e
      Chef::Log.debug "Caught exception => #{e}"
    end
    true
  else
    fail "Unknown fallback policy #{@fallback_policy}"
  end
end
serialized?() click to toggle source

Does this executor guarantee serialization of its operations?

@note

Always returns `false`

@return [Boolean]

True if the executor guarantees that all operations will be post in the
order they are received and no two operations may occur simultaneously.
Else false.
# File lib/garcon/task/executor.rb, line 75
def serialized?
  false
end