code: public synchronized void gainPrimacy() throws IOException {
      Preconditions.checkState(mWriter == null, "writer must be null in secondary mode");
      Preconditions.checkState(mTailerThread != null,
          "tailer thread must not be null in secondary mode");
      mTailerThread.awaitTermination(true);
      long nextSequenceNumber = mTailerThread.getNextSequenceNumber();
      mTailerThread = null;
      nextSequenceNumber = catchUp(nextSequenceNumber);
      mWriter = new UfsJournalLogWriter(this, nextSequenceNumber);
      mAsyncWriter = new AsyncJournalWriter(mWriter);
      mState = State.PRIMARY;
    }
docs: Transitions the journal from secondary to primary mode. The journal will apply the latest
  journal entries to the state machine, then begin to allow writes.