Added cancelReboot().

This commit is contained in:
Ray J. Greenwell
2013-08-23 14:26:47 -07:00
parent e67b9e224f
commit f3e24f5e89
@@ -121,16 +121,27 @@ public abstract class RebootManager
_observers.add(observer);
}
/**
* Cancel the currently scheduled reboot, if any.
*/
public void cancelReboot ()
{
if (_interval != null) {
_interval.cancel();
_interval = null;
}
_nextReboot = 0L;
_rebootSoon = false;
_initiator = null;
}
/**
* Schedules a reboot for the specified time.
*/
public void scheduleReboot (long rebootTime, String initiator)
{
// if there's already a reboot scheduled, cancel it
if (_interval != null) {
_interval.cancel();
_interval = null;
}
cancelReboot();
// note our new reboot time and its initiator
_nextReboot = rebootTime;