private void checkProgress() throws IOException {
    if (now() - mostRecentlyReadTransactionTime > nothingReadCheckTimeout) {
      // check the journal manager
      detectJournalManager();
      
      // we haven't read anything in a while
      if (segmentExists(mostRecentlyReadTransactionTxId + 1) &&
          mostRecentlyReadTransactionTxId != -1) {
        // unclean shutdown happened, we need to switch to next segment
        currentSegmentTxId = mostRecentlyReadTransactionTxId + 1;
        // indicate that we will reopen new stream
        currentEditLogInputStreamPosition = -1;
        
        LOG.warn("Segment - switching to new log segment with txid: "
            + currentSegmentTxId + ". Previous segment was not closed cleanly.");
      } else {
        LOG.warn("Segment - will reopen segment with txid: "
            + currentSegmentTxId + " at position: "
            + currentEditLogInputStreamPosition);
      }
      // in both cases we want to reopen the stream
      currentEditLogInputStream = null;
    }
  }
private void checkProgress ( ) throws IOException { if ( now ( ) - mostRecentlyReadTransactionTime > nothingReadCheckTimeout ) { detectJournalManager ( ) ; if ( segmentExists ( mostRecentlyReadTransactionTxId + 1 ) && mostRecentlyReadTransactionTxId != - 1 ) { currentSegmentTxId = mostRecentlyReadTransactionTxId + 1 ; currentEditLogInputStreamPosition = - 1 ; LOG . warn ( "Segment - switching to new log segment with txid: " + currentSegmentTxId + ". Previous segment was not closed cleanly." ) ; } else { LOG . warn ( "Segment - will reopen segment with txid: " + currentSegmentTxId + " at position: " + currentEditLogInputStreamPosition ) ; } currentEditLogInputStream = null ; } }
If we cannot read anything for some time, we can check if new segment
exists (this would happen on unclean shutdown). Or trigger reopening
current segment.