@ Override public void refresh ( long position , long skippedUntilTxid ) throws IOException { checkInitialized ( ) ; if ( isInProgress ( ) ) { // If a ledger is in progress, re-open it for reading in order // to determine the correct bounds of the ledger. LedgerHandle ledger = ledgerProvider . openForReading ( ledgerId ) ; journalInputStream . resetLedger ( ledger ) ; } // Try to set the underlying stream to the specified position journalInputStream . position ( position ) ; // Reload the position tracker and log reader to adjust to the newly // refreshed position bin = new BufferedInputStream ( journalInputStream ) ; tracker = new PositionTrackingInputStream ( bin , position ) ; DataInputStream in = new DataInputStream ( tracker ) ; if ( position == 0 ) { // If we are at the beginning, re-read the version logVersion = readLogVersion ( in ) ; } reader = new Reader ( in , logVersion ) ; }
Refresh preferably to a known position