protected void scheduleReboot ( long rebootTime , boolean exact , String initiator ) { // if there's already a reboot scheduled, cancel it cancelReboot ( ) ; long now = System . currentTimeMillis ( ) ; rebootTime = Math . max ( rebootTime , now ) ; // don't let reboots happen in the past long delay = rebootTime - now ; int [ ] warnings = getWarnings ( ) ; int level = - 1 ; // assume we're not yet warning for ( int ii = warnings . length - 1 ; ii >= 0 ; ii -- ) { long warnTime = warnings [ ii ] * ( 60L * 1000L ) ; if ( delay <= warnTime ) { level = ii ; if ( ! exact ) { rebootTime = now + warnTime ; } break ; } } // note our new reboot time and its initiator _nextReboot = rebootTime ; _initiator = initiator ; doWarning ( level , ( int ) ( ( rebootTime - now ) / ( 60L * 1000L ) ) ) ; }
Schedule a reboot .