T - type of the Timer Registration Consumerpublic static class HashWheelTimer.TimerRegistration<T extends Consumer<java.lang.Long>> extends java.lang.Object implements java.lang.Runnable, java.lang.Comparable, Pausable, Registration
| Modifier and Type | Field and Description |
|---|---|
static int |
STATUS_CANCELLED |
static int |
STATUS_PAUSED |
static int |
STATUS_READY |
| Constructor and Description |
|---|
TimerRegistration(long rounds,
long offset,
T delegate,
long rescheduleRounds)
Creates a new Timer Registration with given , and .
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
cancel()
Cancel the registration
|
HashWheelTimer.TimerRegistration<T> |
cancelAfterUse()
Cancel this
HashWheelTimer.TimerRegistration after it has been selected and used. |
int |
compareTo(java.lang.Object o) |
void |
decrement()
Decrement an amount of runs Registration has to run until it's elapsed
|
java.lang.Object |
getObject()
The object that was registered
|
Selector |
getSelector()
The
Selector that was used when the registration was made. |
boolean |
isCancelAfterUse()
Whether to cancel this
Registration after use or not. |
boolean |
isCancelled()
Check whether the current Registration is cancelled
|
boolean |
isPaused()
Check whether the current Registration is paused
|
Registration |
pause()
Pause the current Regisration
|
boolean |
ready()
Check whether the current Registration is ready for execution
|
void |
reset()
Reset the Registration
|
Registration |
resume()
Resume current Registration
|
void |
run()
Run the delegate of the current Registration
|
java.lang.String |
toString() |
public static int STATUS_PAUSED
public static int STATUS_CANCELLED
public static int STATUS_READY
public TimerRegistration(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()
run in interface java.lang.Runnablepublic void reset()
public Registration cancel()
cancel in interface Pausablecancel in interface Registrationpublic boolean isCancelled()
isCancelled in interface Registrationpublic Registration pause()
pause in interface Pausablepause in interface Registrationpublic boolean isPaused()
isPaused in interface Registrationpublic Registration resume()
resume in interface Pausableresume in interface Registrationpublic Selector getSelector()
RegistrationSelector that was used when the registration was made.getSelector in interface Registrationpublic java.lang.Object getObject()
RegistrationgetObject in interface Registrationpublic HashWheelTimer.TimerRegistration<T> cancelAfterUse()
HashWheelTimer.TimerRegistration after it has been selected and used. Dispatcher implementations should respect this value and perform
the cancellation.cancelAfterUse in interface Registrationpublic boolean isCancelAfterUse()
RegistrationRegistration after use or not.isCancelAfterUse in interface Registrationpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparablepublic java.lang.String toString()
toString in class java.lang.Object