void addInProgressCheckpoint ( PendingCheckpointStats pending ) { if ( readOnly ) { throw new UnsupportedOperationException ( "Can't create a snapshot of a read-only history." ) ; } if ( maxSize == 0 ) { return ; } checkNotNull ( pending , "Pending checkpoint" ) ; // Grow the array if required. This happens only for the first entries // and makes the iterator logic easier, because we don't have any // null elements with the growing array. if ( checkpointsArray . length < maxSize ) { checkpointsArray = Arrays . copyOf ( checkpointsArray , checkpointsArray . length + 1 ) ; } // Wrap around if we are at the end. The next pos is the least recently // added checkpoint. if ( nextPos == checkpointsArray . length ) { nextPos = 0 ; } checkpointsArray [ nextPos ++ ] = pending ; }
Adds an in progress checkpoint to the checkpoint history .