public class AlarmWatch extends StopWatch
| Modifier and Type | Class and Description |
|---|---|
private class |
AlarmWatch.AlarmNotify
The thread that watches the accumulated time and notifies the monitor
if the alarm intervall has elapsed.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private long |
accumulate
The time to accumulation for a notifiacation to occur.
|
private static long |
DEFACCURACY
The default accuracy.
|
private static long |
DEFALARM
The default alarm intervall.
|
static String |
KEY_ACCURACY
The key linked to the sleeping intervall for time-out rechecks.
|
static String |
KEY_ALARM
The key linked to alarm intervall.
|
private Object |
notify
The object that shuld be notified if alarm time has elapsed.
|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
AlarmWatch(Map prop)
Constructs a new alarm watch.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setAlarm(long newalarm)
Sets an alarm intervall.
|
void |
setMonitor(Object sleeper)
Sets the object that waits for the alarm.
|
void |
start()
Starts the alarm clock.
|
getFormatted, getValue, isCounting, preserve, registerParameter, rescanned, reset, restart, restore, setValue, stopget, setcreateParameter, delivers, exit, getFormatted, getName, getPreserveFile, getString, getString, init, overrideDefaultName, register, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiesinitexitreloadpublic static final String KEY_ALARM
public static final String KEY_ACCURACY
private static final long DEFALARM
private static final long DEFACCURACY
private Object notify
private long accumulate
public AlarmWatch(Map prop)
public void setAlarm(long newalarm)
notify object will be notified
after enough time has been accumulated in this alarm watch.time - The alarm intervall in ms. Zero resets the alarm.setMonitor(java.lang.Object)public void setMonitor(Object sleeper)
start() method, otherwise notifiaction will
not occur. If the method is called when the alarm watch is running,
an IllegalThreadStateException is thrown.public void start()
setMonitor(java.lang.Object), a thread is started that checks on
regular intervalls (see KEY_ACCURACY)
if the alarm intervall has elapsed. As soon as the accumulated time has
passed or reached the alarm intervall, the monitor is notified.