ClojureDocs

导航

命名空间

restart-agent

clojure.core

自 1.2 起可用 (源代码)
  • (restart-agent a new-state & options)
When an agent is failed, changes the agent state to new-state and
then un-fails the agent so that sends are allowed again.  If
a :clear-actions true option is given, any actions queued on the
agent that were being held while it was failed will be discarded,
otherwise those held actions will proceed.  The new-state must pass
the validator if any, or restart will throw an exception and the
agent will remain failed with its old state and error.  Watchers, if
any, will NOT be notified of the new state.  Throws an exception if
the agent is not failed.