public class Watchdog extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
handle
handle
|
static int |
WDT_APPLICATION
WDT_APPLICATION
This action indicates that a watchdog timer expiration is to be handled by the application
itself.
|
static int |
WDT_BREAK
WDT_BREAK
This interrupts the current application (similar to Ctrl-C interruption) when the
watchdog timer expires.
|
static int |
WDT_EVENT
WDT_EVENT
Watchdog timer expiration will notify the first thread in the application that is waiting
for notification using waitOnWatchdogNotify().
|
static int |
WDT_MESSAGE
WDT_MESSAGE
When the watchdog timer expires a WM_WATCHDOG (0x11) message will be sent through
the system message pump.
|
static int |
WDT_REBOOT
WDT_REBOOT
This is the default action.
|
static int |
WDT_RESTART
WDT_RESTART
When the watchdog timer expires this will interrupt the current application and
restart it.
|
static int |
WDT_TERMINATE
WDT_TERMINATE
When the watchdog timer expires the system will terminate the application.
|
Constructor and Description |
---|
Watchdog()
The default constructor creates a Watchdog instance.
|
Watchdog(String title)
Constructor creates a Watchdog instance with defined text.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates (starts) the Watchdog countdown timer.
|
void |
activate(int duration)
Activates (starts) the Watchdog countdown timer with specified duration.
|
void |
deactivate()
Deactivates (stops) the Watchdog countdown timer.
|
void |
delete()
Deletes/removes the Watchdog timer.
|
int |
getAction()
Retrieves the defined action.
|
int |
getDuration()
Retrieves the current timer duration.
|
String |
getText()
Retrieves the defined text reference
|
void |
refresh()
Refreshes the Watchdog countdown timer.
|
void |
removeEventListener()
Removes the event listener for this Watchdog.
|
void |
setAction(int action)
Defines the actions to be taken should the timer expire.
|
void |
setDuration(int duration)
Sets the timer duration (60000 milliseconds is default).
|
void |
setEventListener(WatchdogEventListener listener)
Set an event listener for this Watchdog.
|
void |
setText(String text)
Defines the text used for example when messages are generated.
|
String |
toString()
Returns the string representation of this Watchdog object.
|
boolean |
triggered()
Check if Watchdog triggered.
|
protected int handle
public static final int WDT_REBOOT
public static final int WDT_APPLICATION
public static final int WDT_TERMINATE
public static final int WDT_BREAK
public static final int WDT_RESTART
public static final int WDT_MESSAGE
public static final int WDT_EVENT
public Watchdog()
public Watchdog(String title)
title
- String to be associated with this Watchdogpublic int getAction()
public void setAction(int action)
action
- specified actionpublic int getDuration()
public void setDuration(int duration)
duration
- new timer duration in millisecondspublic String getText()
public void setText(String text)
text
- specified textpublic void activate()
public void activate(int duration)
duration
- new timer duration in millisecondspublic void deactivate()
public void refresh()
public boolean triggered()
public void delete()
public void setEventListener(WatchdogEventListener listener)
listener
- WatchdogEventListener class containing the method to handle
this eventpublic void removeEventListener()