org.apache.excalibur.event.impl
Class ThresholdEnqueuePredicate
java.lang.Object
org.apache.excalibur.event.impl.ThresholdEnqueuePredicate
- All Implemented Interfaces:
- org.apache.excalibur.event.EnqueuePredicate
public final class ThresholdEnqueuePredicate
- extends java.lang.Object
- implements org.apache.excalibur.event.EnqueuePredicate
The ThresholdEnqueuePredicate limits the elements that can be enqueued
based on the size of the Queue.
- Author:
- Avalon Development Team
Method Summary |
boolean |
accept(java.lang.Object[] elements,
org.apache.excalibur.event.Sink modifyingSink)
Returns true if the Sink size + the number of elements is less than
the threshold. |
boolean |
accept(java.lang.Object element,
org.apache.excalibur.event.Sink modifyingSink)
Returns true if the Sink size + 1 (the element) is less than the
threshold. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_threshold
private final int m_threshold
ThresholdEnqueuePredicate
public ThresholdEnqueuePredicate(int limit)
- Create a new ThresholdEnqueuePredicate with the supplied limit.
- Parameters:
limit
- A number greater than zero
accept
public boolean accept(java.lang.Object element,
org.apache.excalibur.event.Sink modifyingSink)
- Returns true if the Sink size + 1 (the element) is less than the
threshold.
- Specified by:
accept
in interface org.apache.excalibur.event.EnqueuePredicate
accept
public boolean accept(java.lang.Object[] elements,
org.apache.excalibur.event.Sink modifyingSink)
- Returns true if the Sink size + the number of elements is less than
the threshold.
- Specified by:
accept
in interface org.apache.excalibur.event.EnqueuePredicate