public interface Timer
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this timer by interrupting the task thread.
|
long |
getResolution()
Get the resolution of this tTimer.
|
Pausable |
schedule(Consumer<Long> consumer,
long period,
TimeUnit timeUnit)
Schedule a recurring task.
|
Pausable |
schedule(Consumer<Long> consumer,
long period,
TimeUnit timeUnit,
long delayInMilliseconds)
Schedule a recurring task.
|
Pausable |
submit(Consumer<Long> consumer)
Submit a task for arbitrary execution after the delay of this timer's resolution.
|
Pausable |
submit(Consumer<Long> consumer,
long delay,
TimeUnit timeUnit)
Submit a task for arbitrary execution after the given time delay.
|
long getResolution()
Pausable schedule(Consumer<Long> consumer, long period, TimeUnit timeUnit, long delayInMilliseconds)
Consumer
will be invoked once every N time units
after the given delay.consumer
- the Consumer
to invoke each periodperiod
- the amount of time that should elapse between invocations of the given Consumer
timeUnit
- the unit of time the period
is to be measured indelayInMilliseconds
- a number of milliseconds in which to delay any execution of the given Consumer
Pausable
that can be used to cancel
, pause
or
resume
the given task.Pausable schedule(Consumer<Long> consumer, long period, TimeUnit timeUnit)
Consumer
will be invoked immediately, as well as
once
every N time units.consumer
- the Consumer
to invoke each periodperiod
- the amount of time that should elapse between invocations of the given Consumer
timeUnit
- the unit of time the period
is to be measured inPausable
that can be used to cancel
, pause
or
resume
the given task.schedule(reactor.fn.Consumer, long, java.util.concurrent.TimeUnit, long)
Pausable submit(Consumer<Long> consumer, long delay, TimeUnit timeUnit)
Pausable submit(Consumer<Long> consumer)
consumer
- the Consumer
to invokevoid cancel()
Copyright © 2017. All rights reserved.