java.lang.Object com.realtime.crossfire.jxclient.timeouts.Timeouts
public class Timeouts
Manages a list of timeouts. Client code can register timeouts with add(int, TimeoutEvent)
or reset(int, TimeoutEvent)
. These timeout
events are called after the given timeout has expired.
Field Summary | |
---|---|
private static java.lang.Runnable |
DELIVER_PENDING_TIMEOUTS
The thread that delivers timeout events. |
private static java.util.PriorityQueue<Event> |
EVENTS
Contains all pending timeout events. |
private static java.util.Map<TimeoutEvent,Event> |
TIMEOUT_EVENTS
Maps TimeoutEvent instance to Event instance. |
Constructor Summary | |
---|---|
private |
Timeouts()
Private constructor to prevent instantiation. |
Method Summary | |
---|---|
private static void |
add(int timeout,
TimeoutEvent timeoutEvent)
Add a timeout event. |
static void |
remove(TimeoutEvent timeoutEvent)
Remove a timeout event. |
static void |
reset(int timeout,
TimeoutEvent timeoutEvent)
Set the timeout value for a given event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private static final java.lang.Runnable DELIVER_PENDING_TIMEOUTS
@NotNull private static final java.util.PriorityQueue<Event> EVENTS
@NotNull private static final java.util.Map<TimeoutEvent,Event> TIMEOUT_EVENTS
TimeoutEvent
instance to Event
instance. This
information is necessary for removing active timeouts.
Constructor Detail |
---|
private Timeouts()
Method Detail |
---|
private static void add(int timeout, @NotNull TimeoutEvent timeoutEvent)
timeout
- The timeout in milliseconds.timeoutEvent
- The timeout event to execute.public static void remove(@NotNull TimeoutEvent timeoutEvent)
timeoutEvent
- The timeout event to remove.public static void reset(int timeout, @NotNull TimeoutEvent timeoutEvent)
timeout
- The new timeout in milliseconds.timeoutEvent
- The timeout event to execute.