public CheckpointStatsSnapshot createSnapshot ( ) { CheckpointStatsSnapshot snapshot = latestSnapshot ; // Only create a new snapshot if dirty and no update in progress, // because we don't want to block the coordinator. if ( dirty && statsReadWriteLock . tryLock ( ) ) { try { // Create a new snapshot snapshot = new CheckpointStatsSnapshot ( counts . createSnapshot ( ) , summary . createSnapshot ( ) , history . createSnapshot ( ) , latestRestoredCheckpoint ) ; latestSnapshot = snapshot ; dirty = false ; } finally { statsReadWriteLock . unlock ( ) ; } } return snapshot ; }
Creates a new snapshot of the available stats .