protected synchronized void addStackIndex(final int index) {
    if (stackIndexes == null) {
      stackIndexes = new int[] { index };
    } else {
      int count = stackIndexes.length;
      stackIndexes = Arrays.copyOf(stackIndexes, count + 1);
      stackIndexes[count] = index;
    }
    wasExecuted = true;
  }
Called by the RootProcedureState on procedure execution. Each procedure store its stack-index
positions.
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/Procedure.java