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);
        }
    }