class Concurrent::Agent

def restart(new_value, opts = {})

Raises:
  • (Concurrent:AgentError) - when not failed

Returns:
  • (Boolean) - true

Options Hash: (**opts)
  • :clear_actions (Symbol) -- true if all enqueued but unprocessed

Parameters:
  • opts (Hash) -- the configuration options
  • new_value (Object) -- the new value for the Agent once restarted
def restart(new_value, opts = {})
  clear_actions = opts.fetch(:clear_actions, false)
  synchronize do
    raise Error.new('agent is not failed') unless failed?
    raise ValidationError unless ns_validate(new_value)
    @current.value = new_value
    @error.value   = nil
    @queue.clear if clear_actions
    ns_post_next_job unless @queue.empty?
  end
  true
end