Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.items.EventScheduler Class Reference

A scheduler for synchronous event notifications. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.items.EventScheduler:

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...
 

Detailed Description

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.

Author
Andreas Kirschbaum

Definition at line 34 of file EventScheduler.java.

Constructor & Destructor Documentation

◆ EventScheduler()

com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler ( final int  delay,
final int  afterEventDelay,
@NotNull final Runnable  eventSchedulerCallback 
)

Creates a new instance.

Parameters
delaythe initial delay
afterEventDelaythe "after-event" delay
eventSchedulerCallbackthe 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.

Member Function Documentation

◆ start()

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().

+ Here is the caller graph for this function:

◆ trigger()

void com.realtime.crossfire.jxclient.items.EventScheduler.trigger ( )

Member Data Documentation

◆ afterEventDelay

final int com.realtime.crossfire.jxclient.items.EventScheduler.afterEventDelay
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().

◆ delay

final int com.realtime.crossfire.jxclient.items.EventScheduler.delay
private

◆ eventSchedulerCallback

final Runnable com.realtime.crossfire.jxclient.items.EventScheduler.eventSchedulerCallback
private

◆ nextAction

long com.realtime.crossfire.jxclient.items.EventScheduler.nextAction
private

The timestamp for the next notification.

Set to

0

when not active.

Definition at line 71 of file EventScheduler.java.

◆ nextActionNotBefore

long com.realtime.crossfire.jxclient.items.EventScheduler.nextActionNotBefore = System.currentTimeMillis()
private

The minimum timestamp for the next notification.

Definition at line 76 of file EventScheduler.java.

◆ runnable

final Runnable com.realtime.crossfire.jxclient.items.EventScheduler.runnable
private

The Runnable delivering notifications through eventSchedulerCallback.

Definition at line 84 of file EventScheduler.java.

Referenced by com.realtime.crossfire.jxclient.items.EventScheduler.EventScheduler().

◆ sync

final Object com.realtime.crossfire.jxclient.items.EventScheduler.sync = new Object()
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().

◆ thread

final Thread com.realtime.crossfire.jxclient.items.EventScheduler.thread
private

The thread running runnable.

Definition at line 65 of file EventScheduler.java.


The documentation for this class was generated from the following file: