void ConcurrentMarkSweepThread::sleepBeforeNextCycle() { while (!_should_terminate) { if (CMSIncrementalMode) { icms_wait(); if(CMSWaitDuration >= 0) { // Wait until the next synchronous GC, a concurrent full gc // request or a timeout, whichever is earlier. wait_on_cms_lock_for_scavenge(CMSWaitDuration); } return; } else { if(CMSWaitDuration >= 0) { // Wait until the next synchronous GC, a concurrent full gc // request or a timeout, whichever is earlier. wait_on_cms_lock_for_scavenge(CMSWaitDuration); } else { // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently wait_on_cms_lock(CMSCheckInterval); } } // Check if we should start a CMS collection cycle if (_collector->shouldConcurrentCollect()) { return; } // .. collection criterion not yet met, let's go back // and wait some more } }
void ConcurrentMarkSweepThread::sleepBeforeNextCycle() { while (!_should_terminate) { if (CMSIncrementalMode) { icms_wait(); return; } else { // Wait until the next synchronous GC or a timeout, whichever is earlier wait_on_cms_lock(CMSWaitDuration); } // Check if we should start a CMS collection cycle if (_collector->shouldConcurrentCollect()) { return; } // .. collection criterion not yet met, let's go back // and wait some more } }