private void processWaitingPeriodicWork ( long now ) { if ( now - m_lastSysprocInvocation < m_minTimeBetweenSysprocs ) { return ; } if ( m_snapshots . size ( ) > m_retain ) { //Quick hack to make sure we don't delete while the snapshot is running. //Deletes work really badly during a snapshot because the FS is occupied if ( ! SnapshotSiteProcessor . ExecutionSitesCurrentlySnapshotting . isEmpty ( ) ) { m_lastSysprocInvocation = System . currentTimeMillis ( ) + 3000 ; return ; } deleteExtraSnapshots ( ) ; return ; } if ( m_nextSnapshotTime < now ) { initiateNextSnapshot ( now ) ; return ; } }
Do periodic work when the daemon is in the waiting state . The daemon paces out sysproc invocations over time to avoid disrupting regular work . If the time for the next snapshot has passed it attempts to initiate a new snapshot . If there are too many snapshots being retains it attempts to delete the extras . Then it attempts to initiate a new snapshot if one is due