org.d_haven.event

Interface EnqueuePredicate

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
booleanaccept(Object element, Sink modifyingSink)
Tests the given element for acceptance onto the m_sink.
booleanaccept(Object[] elements, Sink modifyingSink)
Tests the given element for acceptance onto the m_sink.

Method Detail

accept

public boolean accept(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

public boolean accept(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