org.d_haven.event
Interface EnqueuePredicate

All Known Implementing Classes:
NullEnqueuePredicate, RateLimitingPredicate, SwitchedEnqueuePredicate, ThresholdEnqueuePredicate

public interface EnqueuePredicate

Enqueue predicates allow users to specify a method that will 'screen' elements being enqueued onto a sink, either accepting or rejecting them. This mechanism can be used to implement many interesting load-conditioning policies, for example, simple thresholding, rate control, credit-based flow control, and so forth. Note that the enqueue predicate runs in the context of the caller of enqueue(), which means it must be simple and fast.

Version:
$Revision: 1.4 $
Author:
schierma

Method Summary
 boolean accept(java.lang.Object[] elements, Sink modifyingSink)
          Tests the given element for acceptance onto the m_sink.
 boolean accept(java.lang.Object element, Sink modifyingSink)
          Tests the given element for acceptance onto the m_sink.
 

Method Detail

accept

boolean accept(java.lang.Object element,
               Sink modifyingSink)
Tests the given element for acceptance onto the m_sink.

Parameters:
element - The element to enqueue
modifyingSink - The sink that is used for this predicate
Returns:
true if the sink accepts the element; false otherwise.
Since:
Feb 10, 2003

accept

boolean accept(java.lang.Object[] elements,
               Sink modifyingSink)
Tests the given element for acceptance onto the m_sink.

Parameters:
elements - The array of elements to enqueue
modifyingSink - The sink that is used for this predicate
Returns:
true if the sink accepts all the elements; false otherwise.
Since:
Feb 10, 2003