public class Notifier extends Object implements AutoCloseable
Constructor and Description |
---|
Notifier(Runnable run)
Create a Notifier for timer event notification.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
void |
setHandler(Runnable handler)
Change the handler function.
|
void |
startPeriodic(double period)
Register for periodic event notification.
|
void |
startSingle(double delay)
Register for single event notification.
|
void |
stop()
Stop timer events from occurring.
|
public Notifier(Runnable run)
run
- The handler that is called at the notification time which is set
using StartSingle or StartPeriodic.public void close()
close
in interface AutoCloseable
public void setHandler(Runnable handler)
handler
- Handlerpublic void startSingle(double delay)
delay
- Seconds to wait before the handler is called.public void startPeriodic(double period)
period
- Period in seconds to call the handler starting one period after
the call to this method.public void stop()