public final class Timers extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Timers.Handler |
static class |
Timers.Timer |
| Constructor and Description |
|---|
Timers() |
| Modifier and Type | Method and Description |
|---|---|
Timers.Timer |
add(long interval,
Timers.Handler handler,
Object... args)
Add timer to the set, timer repeats forever, or until cancel is called.
|
boolean |
cancel(Timers.Timer timer)
Cancel a timer.
|
int |
execute()
Execute the timers.
|
boolean |
reset(Timers.Timer timer)
Reset the timer.
|
boolean |
setInterval(Timers.Timer timer,
long interval)
Changes the interval of the timer.
|
int |
sleepAndExecute() |
long |
timeout()
Returns the time in millisecond until the next timer.
|
public Timers.Timer add(long interval, Timers.Handler handler, Object... args)
interval - the interval of repetition in milliseconds.handler - the callback called at the expiration of the timer.args - the optional arguments for the handler.public boolean setInterval(Timers.Timer timer, long interval)
timer - the timer to change the interval to.public boolean reset(Timers.Timer timer)
timer - the timer to reset.public boolean cancel(Timers.Timer timer)
timer - the timer to cancel.public long timeout()
public int execute()
public int sleepAndExecute()
Copyright © 2019. All rights reserved.