rcf.core.concurrent.events
Class AbstractEventSource

java.lang.Object
  extended by rcf.core.concurrent.events.AbstractEventSource
All Implemented Interfaces:
EventSource
Direct Known Subclasses:
AbstractDynamicProperty, AbstractTask, AbstractTransactional

@Revision(value="$Revision: 1.8 $",
          date="$Date: 2006/12/11 21:30:50 $",
          tag="$Name:  $")
public abstract class AbstractEventSource
extends Object
implements EventSource

TODO: Javadoc

TODO: Unit tests, Code review, Javadoc review, Seal/Finalize TODO: equals, hashCode, toString

Version:
$Revision: 1.8 $
Author:
Greg Gibeling

Field Summary
private  int sequenceNumber
          TODO: Javadoc
protected  EventSyndicate syndicate
          TODO: Javadoc
 
Constructor Summary
AbstractEventSource()
           
 
Method Summary
protected  void createdSyndicate()
          TODO: Javadoc Can override to ensure creation of some things when the event syndicate is created.
protected  void destroyedSyndicate()
          TODO: Javadoc Can override to add cleanup for when the event syndicate is destroyed.
 int getSequenceNumber()
          Get the current event sequence number for this source.
 int incSequenceNumber()
          Get the current event sequence number for this source, and increase it for the next call to EventSource.getSequenceNumber().
 boolean isSyndicated()
          Determine if this event source is syndicated; i.e.
 EventSyndicate syndicate()
          Return the current syndicate for this event source, or allocate one if there isn't one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface rcf.core.concurrent.events.EventSource
events
 

Field Detail

sequenceNumber

private volatile int sequenceNumber
TODO: Javadoc


syndicate

protected EventSyndicate syndicate
TODO: Javadoc

Constructor Detail

AbstractEventSource

public AbstractEventSource()
Method Detail

createdSyndicate

protected void createdSyndicate()
TODO: Javadoc Can override to ensure creation of some things when the event syndicate is created.


destroyedSyndicate

protected void destroyedSyndicate()
TODO: Javadoc Can override to add cleanup for when the event syndicate is destroyed.


getSequenceNumber

public final int getSequenceNumber()
Description copied from interface: EventSource
Get the current event sequence number for this source. Sequence numbers should be monotonic, but need not have a step size of 1. Sequence numbers can be used to guess at the ordering of events, and to mark the in a log.

Specified by:
getSequenceNumber in interface EventSource
Returns:
The current event sequence number.

incSequenceNumber

public final int incSequenceNumber()
Description copied from interface: EventSource
Get the current event sequence number for this source, and increase it for the next call to EventSource.getSequenceNumber(). Sequence numbers should be monotonic, but need not have a step size of 1. Sequence numbers can be used to guess at the ordering of events, and to mark the in a log.

Specified by:
incSequenceNumber in interface EventSource
Returns:
The current event sequence number.

isSyndicated

public boolean isSyndicated()
Description copied from interface: EventSource
Determine if this event source is syndicated; i.e. that there are one or more event sink registered to receive events from this source.

Specified by:
isSyndicated in interface EventSource
Returns:
true if there are one or more EventSinks registered to receive events from this source.

syndicate

public EventSyndicate syndicate()
Description copied from interface: EventSource
Return the current syndicate for this event source, or allocate one if there isn't one. This method should never return null unless EventSource.events().ImmutableIterable.isEmpty() == true.

Specified by:
syndicate in interface EventSource
Returns:
The event syndicate which an EventSink should register with (EventSyndicate.add(rcf.core.util.reference.Reference, Class)) to receive events from this source.