protected function hasConcurrentActiveExecution(Execution $execution) { if (!$execution->isConcurrent()) { return false; } foreach ($execution->findConcurrentExecutions() as $concurrent) { if ($concurrent === $execution) { continue; } if (!$concurrent->isActive() || $concurrent->getNode() === $execution->getNode()) { continue; } if ($this->isReachable($concurrent->getNode(), $execution->getNode(), $execution, new \SplObjectStorage())) { return true; } } }
/** * 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]); } } }