ostore.dispatch
Class TSink

java.lang.Object
  |
  +--seda.sandStorm.core.SimpleSink
        |
        +--ostore.dispatch.TSink
All Implemented Interfaces:
ProfilableIF, SinkIF

public class TSink
extends SimpleSink

TSink is an efficient implementation of a Sink. TSink sends events directly to a stage's Sink rather than through a Classifier.

Author:
Aqeel Mahesri

Field Summary
static boolean DEBUG
           
protected  SinkIF mySinkIF
           
static String tag
           
 
Constructor Summary
TSink(String stagename, Classifier classifier)
          Constructs a new TSink for the stage given as an argument.
 
Method Summary
 void enqueue(QueueElementIF event)
          Enqueues the event in the SinkIF corresponding to this TSink's VQueue.
 void enqueueWOChecks(QueueElementIF event)
          Enqueues the event without doing the checks.
 void subscribeNotify(Filter filter, SinkIF sink, Integer priority)
          Notifies all TSinks that a SinkIF has subscribed to a certain type of event via the Classifier.
static void unsubscribeNotify(SinkIF sink)
          Notifies all TSinks that a SinkIF has been unsubscribed from the Classifier.
 
Methods inherited from class seda.sandStorm.core.SimpleSink
enqueue_abort, enqueue_commit, enqueue_lossy, enqueue_many, enqueue_prepare, getEnqueuePredicate, profileSize, setEnqueuePredicate, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

tag

public static final String tag
See Also:
Constant Field Values

mySinkIF

protected SinkIF mySinkIF
Constructor Detail

TSink

public TSink(String stagename,
             Classifier classifier)
      throws NoSuchStageException
Constructs a new TSink for the stage given as an argument. When the requesting stage has the TSink for the given stage, it will be able to pass events directly instead of invoking this Classifier, which should be more efficient.

Parameters:
stagename - Name of the stage whose TSink is requested
classifier - TODO
Method Detail

subscribeNotify

public void subscribeNotify(Filter filter,
                            SinkIF sink,
                            Integer priority)
Notifies all TSinks that a SinkIF has subscribed to a certain type of event via the Classifier. The TSink class stores the event type so that any events of this type are enqueued via the Classifier and reach the stages that need to listen to them. There is one significant limitation. If someone subscribes to a subclass of a message type, then all of the supertypes of the message type should also be marked as subscribed. This is currently not the case; if anyone has a TSink receiving messages with a supertype that is subscribed to, the subscribee will not receive the messages.

Parameters:
sink - The SinkIF to add
filter - The Filter to use.
priority - The Filter's priority

unsubscribeNotify

public static void unsubscribeNotify(SinkIF sink)
Notifies all TSinks that a SinkIF has been unsubscribed from the Classifier.

Parameters:
sink - The SinkIF that is being unsubscribed

enqueue

public void enqueue(QueueElementIF event)
             throws SinkException
Enqueues the event in the SinkIF corresponding to this TSink's VQueue. It also checks whether any stages have subscribed to this type of event via the Classifier; in this case, the event must also be dispatched by the Classifier.

Specified by:
enqueue in interface SinkIF
Specified by:
enqueue in class SimpleSink
Parameters:
event - The event which is to be sent to a queue
SinkException

enqueueWOChecks

public void enqueueWOChecks(QueueElementIF event)
                     throws SinkException
Enqueues the event without doing the checks.

Parameters:
event - The event which is to be sent to a queue
SinkException