Exemple #1
0
 /**
  * Terminate this path of execution, will also terminate all child executions.
  * 
  * @param boolean $triggerExecution Trigger / signal parent execution after termination?
  */
 public function terminate($triggerExecution = true)
 {
     if ($this->hasState(self::STATE_TERMINATE)) {
         return;
     }
     $this->state |= self::STATE_TERMINATE;
     $this->syncState = self::SYNC_STATE_REMOVED;
     $this->engine->debug('Terminate {execution}', ['execution' => (string) $this]);
     foreach ($this->childExecutions as $execution) {
         $execution->terminate(false);
     }
     if ($triggerExecution) {
         $this->timestamp = microtime(true);
     }
     if ($this->parentExecution === NULL) {
         $this->engine->notify(new EndProcessEvent($this->node, $this));
     } else {
         $this->parentExecution->childExecutionTerminated($this, $triggerExecution);
     }
 }