Class DelayedEvent
java.lang.Object
cl.netswitch.lib.server.DelayedEvent
- All Implemented Interfaces:
Comparable<Delayed>, Delayed
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDelayedEvent(long delay) Constructs a newDelayedEventinstance. -
Method Summary
Modifier and TypeMethodDescriptionfinal intCompares this DelayedEvent with the specified object for order.abstract voiddispatch()Dispatched this DelayedEvent to the target listener.final booleanIndicates whether some other object is "equal to" this DelayedEvent.protected final longgetDelay()Returns the delay of this DelayedEvent (milliseconds).final longReturns the remaining delay in the given time unit.final inthashCode()Returns a hash code value of this DelayedEvent.protected DelayedEventReturns a new DelayedEvent for rescheduling (overridable).
-
Constructor Details
-
DelayedEvent
protected DelayedEvent(long delay) Constructs a newDelayedEventinstance.- Parameters:
delay- the delay of this DelayedEvent (milliseconds).- Throws:
IllegalArgumentException- ifdelayis negative.
-
-
Method Details
-
getDelay
protected final long getDelay()Returns the delay of this DelayedEvent (milliseconds).- Returns:
- the delay of this DelayedEvent (milliseconds).
-
reschedule
Returns a new DelayedEvent for rescheduling (overridable).- Returns:
- a new DelayedEvent for rescheduling (overridable).
-
getDelay
Returns the remaining delay in the given time unit.- Specified by:
getDelayin interfaceDelayed- Parameters:
unit- the required time unit of the output- Returns:
- the remaining delay in the given time unit.
- Throws:
NullPointerException- ifunitisnull.
-
hashCode
-
equals
-
compareTo
Compares this DelayedEvent with the specified object for order.- Specified by:
compareToin interfaceComparable<Delayed>- Parameters:
other- the object to compare to this DelayedEvent.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
NullPointerException- ifotherisnull.
-
dispatch
-