public interface WatchdogTimer extends Device<WatchdogTimer>
WatchdogTimer
interface provides methods for controlling a watchdog timer that can be used to force the
device to reboot (or depending on the platform, the Java Virtual Machine to restart).
A WatchdogTimer
instance may represent a virtual watchdog timer. If the device has a single physical watchdog
timer, all of the virtual watchdog timers are mapped onto this one physical watchdog timer. It gets set to expire
when the virtual watchdog with the earliest timeout is scheduled to expire. The corresponding watchdog timer
device is therefore shared and several applications can concurrently acquire the same watchdog timer device.
A watchdog timer may be identified by the numerical ID and by the name (if any defined) that correspond to its
registered configuration. A WatchdogTimer
instance can be opened by a call to one of the
DeviceManager.open(id,...)
methods using its ID or by a call to one of the
DeviceManager.open(name,...)
methods using its name. WatchdogTimer
instances representing each a virtual instance of that same physical watchdog timer to be opened concurrently using
the same device ID, or,
alternatively, it may assign each virtual watchdog timer instance a distinct device ID (and a common name). WatchdogTimer.start
method and subsequently
refresh the timer periodically using the WatchdogTimer.refresh
method
When done, an application should call the WatchdogTimer.close
method to close the watchdog timer.
Any further attempt to access or control a watchdog timer which has been closed will result in a
ClosedDeviceException
been thrown.BIG_ENDIAN, LITTLE_ENDIAN, MIXED_ENDIAN
Modifier and Type | Method and Description |
---|---|
boolean |
causedLastReboot()
Checks if the last device reboot (or JVM restart) was caused by the watchdog timing out.
|
long |
getMaxTimeout()
Gets the maximum timeout that can be set for the watchdog timer.
|
long |
getTimeout()
Get the current timeout for the watchdog timer.
|
void |
refresh()
Refreshes the watchdog timer.
|
void |
start(long timeout)
Starts the watchdog timer with the specified timeout.
|
void |
stop()
Stops this watchdog timer.
|
boolean causedLastReboot() throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
java.io.IOException
- if some other I/O error occurs.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another application.ClosedDeviceException
- if the device has been closed.long getMaxTimeout() throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
java.io.IOException
- if some other I/O error occurs.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another application.ClosedDeviceException
- if the device has been closed.long getTimeout() throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
java.io.IOException
- if some other I/O error occurs.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another application.ClosedDeviceException
- if the device has been closed.void refresh() throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
java.io.IOException
- if some other I/O error occurs.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another application.ClosedDeviceException
- if the device has been closed.void start(long timeout) throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
refresh
prior to the watchdog timing out, the device will be rebooted (or the JVM restarted).
Calling this method twice is equivalent to stopping the timer as per a call to stop()
and starting
it again with the new specified timeout.timeout
- the time interval (in milliseconds) until watchdog times out.java.io.IOException
- if some other I/O error occurs.java.lang.IllegalArgumentException
- if timeout
is not greater than 0
.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another application.ClosedDeviceException
- if the device has been closed.void stop() throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
java.io.IOException
- if some other I/O error occurs.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another application.ClosedDeviceException
- if the device has been closed.Copyright © 2012, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices