Exemplo n.º 1
0
 /**
  * Is being used to notify a parent execution whenever a child execution has been terminated.
  * 
  * @param Execution $execution
  * @param boolean $triggerExecution Trigger / signal this execution?
  */
 protected function childExecutionTerminated(Execution $execution, $triggerExecution = true)
 {
     $removed = false;
     $scope = $execution->isScope() || !$execution->isConcurrent();
     foreach ($this->childExecutions as $index => $exec) {
         if ($exec === $execution) {
             unset($this->childExecutions[$index]);
             $removed = true;
             break;
         }
     }
     if (empty($this->childExecutions) && $scope && $removed && $triggerExecution) {
         if ($this->isWaiting()) {
             $this->signal(NULL, [], ['executionId' => $execution->getId()]);
         } else {
             $this->takeAll(NULL, [$this]);
         }
     }
 }