|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object seda.sandStorm.core.FiniteQueue edu.berkeley.psi.seda.generic.EventSink
public class EventSink
A simple SinkIF which accepts QueueElementIFs and calls an EventHandlerIF. This is a light-weight alternative to a full Stage which can provide in-order servicing of events.
Field Summary | |
---|---|
private java.util.concurrent.atomic.AtomicBoolean |
closed
|
private static int |
DEBUG_LEVEL
|
protected EventHandlerIF |
eh
|
private java.util.concurrent.atomic.AtomicBoolean |
started
|
private java.lang.Thread |
thread
|
Constructor Summary | |
---|---|
EventSink(EventHandlerIF eh)
Create an unnamed EventSink with no EnqueuePredicateIF. |
|
EventSink(EventHandlerIF eh,
EnqueuePredicateIF ep)
Create an unnamed EventSink with an EnqueuePredicateIF. |
|
EventSink(EventHandlerIF eh,
java.lang.String name)
Create a named EventSink with no EnqueuePredicateIF. |
Method Summary | |
---|---|
void |
close()
interrupts the thread and causes it to shut down immediately |
private static boolean |
DEBUG(int n)
|
void |
enqueue_many(QueueElementIF[] enqueueMe)
Envokes the superclass enqueue_many() and makes sure we are servicing the queue. |
void |
enqueue(QueueElementIF enqueueMe)
Envokes the superclass enqueue() and makes sure we are servicing the queue. |
private void |
jumpStart()
Makes sure we are servicing the queue, starting a new thread otherwise. |
void |
run()
|
java.lang.String |
toString()
|
Methods inherited from class seda.sandStorm.core.FiniteQueue |
---|
blocking_dequeue_all, blocking_dequeue, blocking_dequeue, blocking_dequeue, dequeue_all, dequeue, dequeue, dequeue, enqueue_abort, enqueue_commit, enqueue_lossy, enqueue_prepare, getEnqueuePredicate, getName, profileSize, setEnqueuePredicate, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int DEBUG_LEVEL
private java.util.concurrent.atomic.AtomicBoolean started
private java.lang.Thread thread
private java.util.concurrent.atomic.AtomicBoolean closed
protected EventHandlerIF eh
Constructor Detail |
---|
public EventSink(EventHandlerIF eh)
public EventSink(EventHandlerIF eh, java.lang.String name)
public EventSink(EventHandlerIF eh, EnqueuePredicateIF ep)
Method Detail |
---|
private static final boolean DEBUG(int n)
public void enqueue(QueueElementIF enqueueMe) throws SinkFullException
enqueue
in interface SinkIF
enqueue
in class FiniteQueue
enqueueMe
- The QueueElementIF
to enqueue
SinkFullException
- Indicates that the sink is temporarily full.public void enqueue_many(QueueElementIF[] enqueueMe) throws SinkFullException
enqueue_many
in interface SinkIF
enqueue_many
in class FiniteQueue
enqueueMe
- The element array to enqueue
SinkFullException
- Indicates that the sink is temporarily full.private final void jumpStart()
public void run()
run
in interface java.lang.Runnable
public java.lang.String toString()
toString
in class FiniteQueue
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |