protected void doWarning ( int level , int minutes ) { _rebootSoon = ( level > - 1 ) ; int [ ] warnings = getWarnings ( ) ; if ( level == warnings . length ) { if ( checkLocks ( ) ) { return ; } // that's it! do the reboot log . info ( "Performing automatic server reboot/shutdown, as scheduled by: " + _initiator ) ; broadcast ( "m.rebooting_now" ) ; // wait 1 second, then do it new Interval ( Interval . RUN_DIRECT ) { @ Override public void expired ( ) { _server . queueShutdown ( ) ; // this posts a LongRunnable } } . schedule ( 1000 ) ; return ; } // issue the warning if ( _rebootSoon ) { notifyObservers ( level ) ; broadcast ( getRebootMessage ( "m.reboot_warning" , minutes ) ) ; } // schedule the next warning final int nextLevel = level + 1 ; final int nextMinutes = ( nextLevel == warnings . length ) ? 0 : warnings [ nextLevel ] ; _interval = _omgr . newInterval ( new Runnable ( ) { public void run ( ) { doWarning ( nextLevel , nextMinutes ) ; } } ) ; _interval . schedule ( Math . max ( 0L , _nextReboot - ( nextMinutes * 60L * 1000L ) - System . currentTimeMillis ( ) ) ) ; }
Do a warning schedule the next .