code: public Action nextAction(boolean recovering) {
          Action action;
          switch (state) {
              case PREPARING:
                  action = recovering ? Action.ROLLBACK : Action.PREPARE;
                  break;
              case COMMITTING:
                  action = Action.COMMIT;
                  break;
              case COMMITTED:
                  action = recovering ? Action.INITSTATE : Action.PREPARE;
                  break;
              default:
                  throw new IllegalStateException("Unknown state " + state);
          }
          return action;
      }
docs: Get the next action to perform based on this checkpoint state.
  
  @param recovering if in recovering phase
  @return the next action to perform based on this state