Crossfire JXClient, Trunk
R20561
|
A scheduler for synchronous event notifications. More...
Public Member Functions | |
EventScheduler (final int delay, final int afterEventDelay, @NotNull final Runnable eventSchedulerCallback) | |
Creates a new instance. More... | |
void | start () |
Activates this instance. More... | |
void | trigger () |
Notifies the callback. More... | |
Private Attributes | |
final int | afterEventDelay |
The minimum delay between two eventSchedulerCallback notifications. More... | |
final int | delay |
The delay between a call to trigger() until the eventSchedulerCallback is notified. More... | |
final Runnable | eventSchedulerCallback |
The Runnable to notify. More... | |
long | nextAction |
The timestamp for the next notification. More... | |
long | nextActionNotBefore = System.currentTimeMillis() |
The minimum timestamp for the next notification. More... | |
final Runnable | runnable |
The Runnable delivering notifications through eventSchedulerCallback. More... | |
final Object | sync = new Object() |
The object used to synchronize access to nextAction and nextActionNotBefore. More... | |
final Thread | thread |
The thread running runnable. More... | |
A scheduler for synchronous event notifications.
Notifications are triggered by calling trigger(). Notifications are delivered by calling the event scheduler callback of eventSchedulerCallback. This callback is called delay after the last call to trigger() but not faster than once per eventSchedulerCallback.
Definition at line 34 of file EventScheduler.java.
com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler | ( | final int | delay, |
final int | afterEventDelay, | ||
@NotNull final Runnable | eventSchedulerCallback | ||
) |
Creates a new instance.
delay | the initial delay |
afterEventDelay | the "after-event" delay |
eventSchedulerCallback | the callback to notify |
Definition at line 127 of file EventScheduler.java.
References com.realtime.crossfire.jxclient.items.EventScheduler.afterEventDelay, com.realtime.crossfire.jxclient.items.EventScheduler.delay, com.realtime.crossfire.jxclient.items.EventScheduler.eventSchedulerCallback, and com.realtime.crossfire.jxclient.items.EventScheduler.runnable.
void com.realtime.crossfire.jxclient.items.EventScheduler.start | ( | ) |
Activates this instance.
Definition at line 137 of file EventScheduler.java.
Referenced by com.realtime.crossfire.jxclient.items.AbstractItemView.AbstractItemView().
void com.realtime.crossfire.jxclient.items.EventScheduler.trigger | ( | ) |
Notifies the callback.
Definition at line 144 of file EventScheduler.java.
References com.realtime.crossfire.jxclient.items.EventScheduler.delay, and com.realtime.crossfire.jxclient.items.EventScheduler.sync.
Referenced by com.realtime.crossfire.jxclient.items.AbstractItemView.fireEvents().
|
private |
The minimum delay between two eventSchedulerCallback notifications.
Definition at line 46 of file EventScheduler.java.
Referenced by com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler().
|
private |
The delay between a call to trigger() until the eventSchedulerCallback is notified.
Definition at line 40 of file EventScheduler.java.
Referenced by com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler(), and com.realtime.crossfire.jxclient.items.EventScheduler.trigger().
|
private |
The Runnable to notify.
Definition at line 52 of file EventScheduler.java.
Referenced by com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler().
|
private |
The timestamp for the next notification.
Set to
when not active.
Definition at line 71 of file EventScheduler.java.
|
private |
The minimum timestamp for the next notification.
Definition at line 76 of file EventScheduler.java.
|
private |
The Runnable delivering notifications through eventSchedulerCallback.
Definition at line 84 of file EventScheduler.java.
Referenced by com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler().
|
private |
The object used to synchronize access to nextAction and nextActionNotBefore.
Definition at line 59 of file EventScheduler.java.
Referenced by com.realtime.crossfire.jxclient.items.EventScheduler.trigger().
|
private |
The thread running runnable.
Definition at line 65 of file EventScheduler.java.