public synchronized long getCheckpointedSequence ( ) { long sequence = lastSequence ; if ( ! sequences . isEmpty ( ) ) { sequence = sequences . first ( ) - 1 ; } if ( sequence > firstValueSequence ) { // Garbage-collect inaccessible values: int numToRemove = ( int ) ( sequence - firstValueSequence ) ; for ( int i = 0 ; i < numToRemove ; i ++ ) { values . remove ( 0 ) ; } firstValueSequence += numToRemove ; } return sequence ; }
Returns the maximum consecutively - removed sequence number . This is one less than the minimum remaining sequence number .