Esempio n. 1
0
 private void checkForCompletion(final GraphProcess process) {
   if (!process.hasActiveTokens() && process.isArcTokenQueueEmpty() && asyncQueue.isEmpty()) {
     process.setState(ProcessState.PendingCompletion);
     fireEvent(ProcessEvent.newCompletedEvent(this, process));
     finalizeComplete(process);
   }
 }
Esempio n. 2
0
  @Override
  public void startProcess(GraphProcess process) {
    process.setState(ProcessState.Executing);
    fireEvent(ProcessEvent.newStartedEvent(this, process));

    arcExecutionStarted = true;

    try {
      for (Node startNode : process.getGraph().getStartNodes()) {
        NodeToken startToken =
            getFactory().newNodeToken(process, startNode, new ArrayList<ArcToken>(0));
        process.addNodeToken(startToken);
        executeNode(process, startToken);
      }
      executeQueuedArcTokens(process);
    } finally {
      arcExecutionStarted = false;
      drainAsyncQueue(process);
    }

    if (process.isExecuting()) {
      checkForCompletion(process);
    }
  }
Esempio n. 3
0
 @Override
 public void cancelProcess(GraphProcess process) {
   process.setState(ProcessState.PendingCancel);
   fireEvent(ProcessEvent.newCanceledEvent(this, process));
   finalizeCancel(process);
 }