|
More information: http://www.cs.berkeley.edu/~mdw/proj/seda/ | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mdw.sandStorm.internal.SinkProxy
Used as a proxy to observe and measure communication behavior between stages. By handing out a SinkProxy instead of a FiniteQueue, it is possible to gather statistics on event communication between stages. This is used by StageGraph to construct a graph of the communication patterns between stages.
Field Summary | |
int |
enqueueCount
Maintains a running sum of the number of elements enqueued onto this sink. |
int |
enqueueSuccessCount
Maintains a running sum of the number of elements successfully enqueued onto this sink (that is, not rejected by the enqueue predicate). |
SinkIF |
thesink
|
long |
timer
Used to maintain a timer for statistics gathering. |
Constructor Summary | |
SinkProxy(SinkIF sink,
ManagerIF mgr,
StageWrapperIF toStage)
Create a SinkProxy for the given sink. |
Method Summary | |
void |
enqueue_abort(java.lang.Object key)
Abort a previously prepared provisional enqueue operation (from the enqueue_prepare() method). |
void |
enqueue_commit(java.lang.Object key)
Commit a previously prepared provisional enqueue operation (from the enqueue_prepare() method). |
boolean |
enqueue_lossy(QueueElementIF enqueueMe)
Enqueues the given element onto the queue. |
void |
enqueue_many(QueueElementIF[] enqueueMe)
Given an array of elements, atomically enqueues all of the elements in the array. |
java.lang.Object |
enqueue_prepare(QueueElementIF[] enqueueMe)
Support for transactional enqueue. |
void |
enqueue(QueueElementIF enqueueMe)
Enqueues the given element onto the queue. |
EnqueuePredicateIF |
getEnqueuePredicate()
Return the enqueue predicate for this sink. |
int |
profileSize()
Return the profile size of the queue. |
void |
setEnqueuePredicate(EnqueuePredicateIF pred)
Set the enqueue predicate for this sink. |
int |
size()
Return the size of the queue. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
|
Field Detail |
public SinkIF thesink
public int enqueueCount
public int enqueueSuccessCount
public long timer
Constructor Detail |
public SinkProxy(SinkIF sink, ManagerIF mgr, StageWrapperIF toStage)
sink
- The sink to create a proxy for.mgr
- The associated manager.toStage
- The stage which this sink pushes events to.Method Detail |
public int size()
size
in interface SinkIF
public void enqueue(QueueElementIF enqueueMe) throws SinkException
SinkIF
enqueue
in interface SinkIF
mdw.sandStorm.api.SinkIF
element
- The QueueElementIF
to enqueueSinkFullException
- Indicates that the sink is temporarily full.SinkClosedException
- Indicates that the sink is
no longer being serviced.public boolean enqueue_lossy(QueueElementIF enqueueMe)
SinkIF
enqueue_lossy
in interface SinkIF
mdw.sandStorm.api.SinkIF
element
- The QueueElementIF
to enqueuepublic void enqueue_many(QueueElementIF[] enqueueMe) throws SinkException
SinkIF
enqueue_many
in interface SinkIF
mdw.sandStorm.api.SinkIF
elements
- The element array to enqueueSinkFullException
- Indicates that the sink is temporarily full.SinkClosedException
- Indicates that the sink is
no longer being serviced.public int profileSize()
profileSize
in interface ProfilableIF
public java.lang.Object enqueue_prepare(QueueElementIF[] enqueueMe) throws SinkException
SinkIF
This method allows a client to provisionally enqueue a number of elements onto the queue, and then later commit the enqueue (with a enqueue_commit() call), or abort (with a enqueue_abort() call). This mechanism can be used to perform "split-phase" enqueues, where a client first enqueues a set of elements on the queue and then performs some work to "fill in" those elements before performing a commit. This can also be used to perform multi-queue transactional enqueue operations, with an "all-or-nothing" strategy for enqueueing events on multiple queues.
This method would generally be used in the following manner:
Object key = sink.enqueue_prepare(someElements); if (can_commit) { sink.enqueue_commit(key); } else { sink.enqueue_abort(key); }
Note that this method does not protect against "dangling prepares" -- that is, a prepare without an associated commit or abort operation. This method should be used with care. In particular, be sure that all code paths (such as exceptions) after a prepare include either a commit or an abort.
Like enqueue_many, enqueue_prepare is an "all or none" operation: the enqueue predicate must accept all elements for enqueue, or none of them will be enqueued.
enqueue_prepare
in interface SinkIF
mdw.sandStorm.api.SinkIF
elements
- The element array to provisionally enqueueSinkFullException
- Indicates that the sink is temporarily full
and that the requested elements could not be provisionally enqueued.SinkClosedException
- Indicates that the sink is
no longer being serviced.enqueue_commit
,
enqueue_abort
public void enqueue_commit(java.lang.Object key)
SinkIF
enqueue_commit
in interface SinkIF
mdw.sandStorm.api.SinkIF
key
- The enqueue key returned by a previous call to
enqueue_prepare().java.lang.IllegalArgumentException
- Thrown if an unknown enqueue key
is provided.public void enqueue_abort(java.lang.Object key)
SinkIF
enqueue_abort
in interface SinkIF
mdw.sandStorm.api.SinkIF
key
- The enqueue key returned by a previous call to
enqueue_prepare().java.lang.IllegalArgumentException
- Thrown if an unknown enqueue key
is provided.public void setEnqueuePredicate(EnqueuePredicateIF pred)
SinkIF
setEnqueuePredicate
in interface SinkIF
public EnqueuePredicateIF getEnqueuePredicate()
SinkIF
getEnqueuePredicate
in interface SinkIF
public java.lang.String toString()
toString
in class java.lang.Object
|
More information: http://www.cs.berkeley.edu/~mdw/proj/seda/ | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |