java.lang.Object
cl.netswitch.lib.server.DeplayedEvent
- All Implemented Interfaces:
Comparable<Delayed>
,Delayed
Implements the logic common to all delayed events.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal int
Compares this DeplayedEvent with the specified object for order.abstract void
dispatch()
Dispatched this DeplayedEvent to the target listener.final boolean
Indicates whether some other object is "equal to" this DeplayedEvent.final long
Returns the remaining delay in the given time unit.final int
hashCode()
Returns a hash code value of this DeplayedEvent.final long
reset()
Resets the expiration time of this DeplayedEvent for reuse.
-
Constructor Details
-
DeplayedEvent
public DeplayedEvent(long delay) Constructs a newDeplayedEvent
instance.- Parameters:
delay
- the delay of this DeplayedEvent (milliseconds).- Throws:
IllegalArgumentException
- ifdelay
is negative.
-
-
Method Details
-
reset
public final long reset()Resets the expiration time of this DeplayedEvent for reuse.- Returns:
- the delay between consecutive executions (milliseconds).
-
getDelay
Returns the remaining delay in the given time unit.- Specified by:
getDelay
in interfaceDelayed
- Parameters:
unit
- the required time unit of the output- Returns:
- the remaining delay in the given time unit.
- Throws:
NullPointerException
- ifunit
isnull
.
-
hashCode
public final int hashCode()Returns a hash code value of this DeplayedEvent. -
equals
Indicates whether some other object is "equal to" this DeplayedEvent. -
compareTo
Compares this DeplayedEvent with the specified object for order.- Specified by:
compareTo
in interfaceComparable<Delayed>
- Parameters:
that
- the object to compare to this DeplayedEvent.- Returns:
- a negative integer, zero, or a positive integer as this object
is less than, equal to, or greater than
that
object. - Throws:
NullPointerException
- ifthat
isnull
.
-
dispatch
Dispatched this DeplayedEvent to the target listener.- Throws:
Exception
- if an error occurs.
-