public void replay ( ReplayCallback replayCallback ) { TempBuffer tReadBuffer = TempBuffer . createLarge ( ) ; byte [ ] readBuffer = tReadBuffer . buffer ( ) ; int bufferLength = readBuffer . length ; try ( InStore jIn = _blockStore . openRead ( _startAddress , getSegmentSize ( ) ) ) { Replay replay = readReplay ( jIn ) ; if ( replay == null ) { return ; } long address = replay . getCheckpointStart ( ) ; long next ; setSequence ( replay . getSequence ( ) ) ; TempBuffer tBuffer = TempBuffer . create ( ) ; byte [ ] tempBuffer = tBuffer . buffer ( ) ; jIn . read ( getBlockAddress ( address ) , readBuffer , 0 , bufferLength ) ; ReadStream is = new ReadStream ( ) ; while ( address < _tailAddress && ( next = scanItem ( jIn , address , readBuffer , tempBuffer ) ) > 0 ) { boolean isOverflow = getBlockAddress ( address ) != getBlockAddress ( next ) ; // if scanning has passed the buffer boundary, need to re-read // the initial buffer if ( isOverflow ) { jIn . read ( getBlockAddress ( address ) , readBuffer , 0 , bufferLength ) ; } ReplayInputStream rIn = new ReplayInputStream ( jIn , readBuffer , address ) ; is . init ( rIn ) ; try { replayCallback . onItem ( is ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; log . log ( Level . FINER , e . toString ( ) , e ) ; } address = next ; if ( isOverflow ) { jIn . read ( getBlockAddress ( address ) , readBuffer , 0 , bufferLength ) ; } _index = address ; _flushIndex = address ; } } }
Replays all open journal entries . The journal entry will call into the callback listener with an open InputStream to read the entry .