public final class FixedSizeQueue extends AbstractQueue
Queue that has a fixed size. Once
the maximum number of elements are set, this Queue cannot be
changed.| Modifier and Type | Class and Description |
|---|---|
private static class |
FixedSizeQueue.FixedSizePreparedEnqueue
Deprecated.
|
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object[] |
m_elements
Deprecated.
|
private int |
m_end
Deprecated.
|
private EDU.oswego.cs.dl.util.concurrent.ReentrantLock |
m_mutex
Deprecated.
|
protected int |
m_reserve
Deprecated.
|
private int |
m_start
Deprecated.
|
EMPTY_ARRAY, m_interceptor, m_predicate, m_timeout| Constructor and Description |
|---|
FixedSizeQueue(int size)
Deprecated.
Create a
FixedSizedQueue with the specified maximum size. |
| Modifier and Type | Method and Description |
|---|---|
private void |
addElement(java.lang.Object element)
Deprecated.
|
java.lang.Object |
dequeue()
Deprecated.
|
java.lang.Object[] |
dequeue(int numElements)
Deprecated.
|
java.lang.Object[] |
dequeueAll()
Deprecated.
|
void |
enqueue(java.lang.Object element)
Deprecated.
|
void |
enqueue(java.lang.Object[] elements)
Deprecated.
|
int |
maxSize()
Deprecated.
Default maxSize to -1 which is unbounded
|
org.apache.excalibur.event.PreparedEnqueue |
prepareEnqueue(java.lang.Object[] elements)
Deprecated.
|
private java.lang.Object |
removeElement()
Deprecated.
|
private java.lang.Object[] |
retrieveElements(int count)
Deprecated.
Removes exactly
count elements from the underlying
element store and returns them as an array of Objects. |
int |
size()
Deprecated.
|
boolean |
tryEnqueue(java.lang.Object element)
Deprecated.
|
block, canAccept, getDequeueInterceptor, getEnqueuePredicate, isFull, setDequeueInterceptor, setEnqueuePredicate, setTimeoutprivate final java.lang.Object[] m_elements
private final EDU.oswego.cs.dl.util.concurrent.ReentrantLock m_mutex
private int m_start
private int m_end
protected int m_reserve
public FixedSizeQueue(int size)
FixedSizedQueue with the specified maximum size.
The maximum size must be 1 or more.size - The maximum number of events the Queue can handlepublic int size()
public int maxSize()
AbstractQueuemaxSize in interface org.apache.excalibur.event.SinkmaxSize in class AbstractQueuepublic org.apache.excalibur.event.PreparedEnqueue prepareEnqueue(java.lang.Object[] elements)
throws org.apache.excalibur.event.SinkException
org.apache.excalibur.event.SinkExceptionpublic boolean tryEnqueue(java.lang.Object element)
public void enqueue(java.lang.Object[] elements)
throws org.apache.excalibur.event.SinkException
org.apache.excalibur.event.SinkExceptionpublic void enqueue(java.lang.Object element)
throws org.apache.excalibur.event.SinkException
org.apache.excalibur.event.SinkExceptionpublic java.lang.Object[] dequeue(int numElements)
private final void addElement(java.lang.Object element)
private final java.lang.Object removeElement()
private final java.lang.Object[] retrieveElements(int count)
count elements from the underlying
element store and returns them as an array of Objects.
The caller is responsible for synchronizing access to the
element store and passing the correct value for
count.
The method can be further optimized by using System.arraycopy if it is found to underperform.
count - number of elements to returnpublic java.lang.Object[] dequeueAll()
public java.lang.Object dequeue()