edu.berkeley.psi.seda.generic
Class EventSinkFactory
java.lang.Object
edu.berkeley.psi.seda.generic.EventSinkFactory
- All Implemented Interfaces:
- SinkFactoryIF
public class EventSinkFactory
- extends java.lang.Object
- implements SinkFactoryIF
Creates EventSink objects on demand. Can either (re)use a single
EventHandlerIF object (which must be thread safe) or else generate
new EventHandlerIF objects on demand, depending on how it is
initialized. Both approaches have their merits, as using a single
EventHandlerIF object may make it easier for a group of related
EventSinks to communicate, while generating new EventHandlerIF objects
may make it easier to have independent operation.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
handler
EventHandlerIF handler
factory
EventHandlerFactoryIF factory
prefix
protected java.lang.String prefix
pred
protected EnqueuePredicateIF pred
serial
protected java.util.concurrent.atomic.AtomicLong serial
EventSinkFactory
EventSinkFactory(EventHandlerIF eh)
EventSinkFactory
EventSinkFactory(EventHandlerIF eh,
java.lang.String namePrefix)
EventSinkFactory
EventSinkFactory(EventHandlerIF eh,
EnqueuePredicateIF predicate)
EventSinkFactory
EventSinkFactory(EventHandlerFactoryIF factory)
EventSinkFactory
EventSinkFactory(EventHandlerFactoryIF factory,
java.lang.String namePrefix)
EventSinkFactory
EventSinkFactory(EventHandlerFactoryIF factory,
EnqueuePredicateIF predicate)
newSink
protected SinkIF newSink(EventHandlerIF eh)
newSink
public SinkIF newSink()
- Creates a new instance of a SinkIF
- Specified by:
newSink
in interface SinkFactoryIF
setHashPrefix
private void setHashPrefix()
getPrefix
protected java.lang.String getPrefix()
- Returns the prefix of the factory, setting it if null.
Uses test and test-and-set to avoid the lock overhead in most cases.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object