public final class Timers extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Timers.Handler |
static class |
Timers.Timer |
| Constructor and Description |
|---|
Timers() |
Timers(Supplier<Long> clock)
Builds a new timer.
|
| 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)
Deprecated.
use
Timers.Timer.cancel() instead |
int |
execute()
Execute the timers.
|
boolean |
reset(Timers.Timer timer)
Deprecated.
use
Timers.Timer.reset() instead |
boolean |
setInterval(Timers.Timer timer,
long interval)
Deprecated.
use
Timers.Timer.setInterval(long) instead |
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.@Deprecated public boolean setInterval(Timers.Timer timer, long interval)
Timers.Timer.setInterval(long) insteadtimer - the timer to change the interval to.@Deprecated public boolean reset(Timers.Timer timer)
Timers.Timer.reset() insteadtimer - the timer to reset.@Deprecated public boolean cancel(Timers.Timer timer)
Timers.Timer.cancel() insteadtimer - the timer to cancel.public long timeout()
public int execute()
public int sleepAndExecute()
Copyright © 2020. All rights reserved.