예제 #1
0
  private boolean transitionState(
      ExecutionState currentState, ExecutionState targetState, Throwable error) {
    if (STATE_UPDATER.compareAndSet(this, currentState, targetState)) {
      markTimestamp(targetState);

      LOG.info(
          getVertex().getTaskNameWithSubtaskIndex()
              + " ("
              + getAttemptId()
              + ") switched from "
              + currentState
              + " to "
              + targetState);

      // make sure that the state transition completes normally.
      // potential errors (in listeners may not affect the main logic)
      try {
        vertex.notifyStateTransition(attemptId, targetState, error);
      } catch (Throwable t) {
        LOG.error("Error while notifying execution graph of execution state transition.", t);
      }
      return true;
    } else {
      return false;
    }
  }