T
- type of the Timer Registration Consumerpublic static class HashWheelTimer.TimerPausable<T extends Consumer<Long>> extends Object implements Runnable, Comparable, Pausable
Modifier and Type | Field and Description |
---|---|
static int |
STATUS_CANCELLED |
static int |
STATUS_PAUSED |
static int |
STATUS_READY |
Constructor and Description |
---|
TimerPausable(long rounds,
long offset,
T delegate,
long rescheduleRounds)
Creates a new Timer Registration with given , and .
|
Modifier and Type | Method and Description |
---|---|
HashWheelTimer.TimerPausable |
cancel()
Cancel the registration
|
HashWheelTimer.TimerPausable<T> |
cancelAfterUse()
Cancel this
HashWheelTimer.TimerPausable after it has been selected and used. |
int |
compareTo(Object o) |
void |
decrement()
Decrement an amount of runs Registration has to run until it's elapsed
|
long |
getOffset() |
boolean |
isCancelAfterUse() |
boolean |
isCancelled()
Check whether the current Registration is cancelled
|
boolean |
isPaused()
Check whether the current Registration is paused
|
HashWheelTimer.TimerPausable |
pause()
Pause the current Regisration
|
boolean |
ready()
Check whether the current Registration is ready for execution
|
void |
reset()
Reset the Registration
|
HashWheelTimer.TimerPausable |
resume()
Resume current Registration
|
void |
run()
Run the delegate of the current Registration
|
String |
toString() |
public static int STATUS_PAUSED
public static int STATUS_CANCELLED
public static int STATUS_READY
public TimerPausable(long rounds, long offset, T delegate, long rescheduleRounds)
rounds
- amount of rounds the Registration should go through until it's elapsedoffset
- offset of in the Ring Buffer for reschedulingdelegate
- delegate that will be ran whenever the timer is elapsedpublic void decrement()
public boolean ready()
public void run()
public void reset()
public HashWheelTimer.TimerPausable cancel()
public boolean isCancelled()
public HashWheelTimer.TimerPausable pause()
public boolean isPaused()
public HashWheelTimer.TimerPausable resume()
public HashWheelTimer.TimerPausable<T> cancelAfterUse()
HashWheelTimer.TimerPausable
after it has been selected and used. Dispatcher
implementations should respect this value and perform
the cancellation.public boolean isCancelAfterUse()
public int compareTo(Object o)
compareTo
in interface Comparable
public long getOffset()
Copyright © 2017. All rights reserved.