public void checkForTimeouts ( long checkTime ) { TimeSlot nextSlot = this . firstSlot ; TimerWorkItem entry = null ; TimeSlot oldSlot = null ; while ( nextSlot != null && checkTime >= nextSlot . timeoutTime ) { // Timeout all entries here int endIndex = nextSlot . lastEntryIndex ; for ( int i = 0 ; i <= endIndex ; i ++ ) { // invoke callback if not already cancelled entry = nextSlot . entries [ i ] ; if ( entry . state == TimerWorkItem . ENTRY_ACTIVE ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found a timeout, calling timerTriggered" ) ; } entry . state = TimerWorkItem . ENTRY_CANCELLED ; entry . callback . timerTriggered ( entry ) ; } } // since we timed out all slot entries, remove it oldSlot = nextSlot ; removeSlot ( oldSlot ) ; nextSlot = nextSlot . nextEntry ; } }
Check for timeouts in the time slot list .