public class ThirdEventThread extends Thread
The thread has be waked up using wakeup()
method. After a time defined by the ThirdEventThread.ThirdEventWidget
, the
thread asks to the ThirdEventThread.ThirdEventWidget
to send the event.
At any moment the thread can stop event timeout calling the method goToSleep()
.
Modifier and Type | Class and Description |
---|---|
static interface |
ThirdEventThread.ThirdEventWidget
The
ThirdEventThread requires an implementation of ThirdEventThread.ThirdEventWidget to send to event after a
sleep period. |
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
ThirdEventThread(ThirdEventThread.ThirdEventWidget widget,
boolean infinite)
Creates a ThirdEventThread for the ThirdEventWidget.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this thread stopping it.
|
void |
goToSleep()
Sleeps the thread.
|
boolean |
isSendingThirdEvent()
Returns true when a call to
wakeup() has been performed whereas a call to goToSleep() not. |
void |
run()
If this thread was constructed using a separate Runnable run object, then that Runnable object's
run method is called; otherwise, this method does nothing and returns.
|
void |
wakeup()
Wakes up the thread: it will waits during waiting period before send the third event.
|
activeCount, checkAccess, currentThread, dumpStack, enumerate, getAllStackTraces, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
public ThirdEventThread(ThirdEventThread.ThirdEventWidget widget, boolean infinite)
widget
- the widget which sends the third event.infinite
- true to send the third event indifinitively until goToSleep()
is called.public void dispose()
public void goToSleep()
public boolean isSendingThirdEvent()
wakeup()
has been performed whereas a call to goToSleep()
not.public void run()
Thread
run
in interface Runnable
run
in class Thread
Thread.run()
public void wakeup()