org.apache.excalibur.event.impl
Class DefaultQueue
java.lang.Object
org.apache.excalibur.event.impl.AbstractQueue
org.apache.excalibur.event.impl.DefaultQueue
- All Implemented Interfaces:
- Queue, Sink, Source
public final class DefaultQueue
- extends AbstractQueue
The default queue implementation is a variable size queue. This queue is
thread safe, however the overhead in synchronization costs a few extra
milliseconds.
- Author:
- Avalon Development Team
| Fields inherited from interface org.apache.excalibur.event.Queue |
ROLE |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_reserve
protected int m_reserve
DefaultQueue
public DefaultQueue(int size)
- Construct a new DefaultQueue with the specified number of elements.
if the number of elements is greater than zero, then the
Queue is bounded by that number. Otherwise, the
Queue is not bounded at all.
- Parameters:
size - The maximum number of elements in the Queue.
Any number less than 1 means there is no limit.
DefaultQueue
public DefaultQueue(EnqueuePredicate predicate)
DefaultQueue
public DefaultQueue()
- Create an unbounded DefaultQueue.
size
public int size()
- Return the number of elements currently in the
Queue.
- Returns:
int representing the number of elements (including the reserved ones).
maxSize
public int maxSize()
- Return the maximum number of elements that will fit in the
Queue. A number below 1 indecates an unbounded
Queue, which means there is no limit.
- Specified by:
maxSize in interface Sink- Overrides:
maxSize in class AbstractQueue
- Returns:
int representing the maximum number of elements
prepareEnqueue
public PreparedEnqueue prepareEnqueue(Object[] elements)
throws SinkException
- Throws:
SinkException
tryEnqueue
public boolean tryEnqueue(Object element)
enqueue
public void enqueue(Object[] elements)
throws SinkException
- Throws:
SinkException
enqueue
public void enqueue(Object element)
throws SinkException
- Throws:
SinkException
dequeue
public Object[] dequeue(int numElements)
dequeueAll
public Object[] dequeueAll()
dequeue
public Object dequeue()
Copyright © 2012 Apache Software Foundation. All Rights Reserved.