Exemplo 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);
   }
 }
Exemplo 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);
    }
  }
Exemplo n.º 3
0
 @Override
 public void cancelProcess(GraphProcess process) {
   process.setState(ProcessState.PendingCancel);
   fireEvent(ProcessEvent.newCanceledEvent(this, process));
   finalizeCancel(process);
 }