public function end(ezcWorkflowNode $node = null)
{
if (!$this->cancelled) {
if ($node !== null) {
foreach ($this->plugins as $plugin) {
$plugin->afterNodeExecuted($this, $node);
}
}
$this->ended = true;
$this->resumed = false;
$this->suspended = false;
$this->doEnd();
$this->saveToVariableHandlers();
if ($node !== null) {
$this->endThread($node->getThreadId());
foreach ($this->plugins as $plugin) {
$plugin->afterExecutionEnded($this);
}
}
} else {
foreach ($this->plugins as $plugin) {
$plugin->afterExecutionCancelled($this);
}
}
}