code: protected final synchronized void transitionState(OperationState newState) {
      getLogger().debug("Transitioned state from %s to %s", state, newState);
      state = newState;
      // Discard our buffer when we no longer need it.
      if(state != OperationState.WRITE_QUEUED
          && state != OperationState.WRITING) {
        cmd = null;
      }
      if (state == OperationState.COMPLETE) {
        callback.complete();
      }
    }
docs: Transition the state of this operation to the given state.