org.apache.excalibur.event.impl
Class FixedSizeQueue

java.lang.Object
  extended by org.apache.excalibur.event.impl.AbstractQueue
      extended by org.apache.excalibur.event.impl.FixedSizeQueue
All Implemented Interfaces:
org.apache.excalibur.event.Queue, org.apache.excalibur.event.Sink, org.apache.excalibur.event.Source

Deprecated. Use the DefaultQueue as it properly supports the EnqueuePredicates

public final class FixedSizeQueue
extends AbstractQueue

An implementation of the Queue that has a fixed size. Once the maximum number of elements are set, this Queue cannot be changed.

Author:
Avalon Development Team

Nested Class Summary
private static class FixedSizeQueue.FixedSizePreparedEnqueue
          Deprecated.  
 
Field Summary
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.  
 
Fields inherited from class org.apache.excalibur.event.impl.AbstractQueue
EMPTY_ARRAY, m_interceptor, m_predicate, m_timeout
 
Fields inherited from interface org.apache.excalibur.event.Queue
ROLE
 
Constructor Summary
FixedSizeQueue(int size)
          Deprecated. Create a FixedSizedQueue with the specified maximum size.
 
Method Summary
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.  
 
Methods inherited from class org.apache.excalibur.event.impl.AbstractQueue
block, canAccept, getDequeueInterceptor, getEnqueuePredicate, isFull, setDequeueInterceptor, setEnqueuePredicate, setTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_elements

private final java.lang.Object[] m_elements
Deprecated. 

m_mutex

private final EDU.oswego.cs.dl.util.concurrent.ReentrantLock m_mutex
Deprecated. 

m_start

private int m_start
Deprecated. 

m_end

private int m_end
Deprecated. 

m_reserve

protected int m_reserve
Deprecated. 
Constructor Detail

FixedSizeQueue

public FixedSizeQueue(int size)
Deprecated. 
Create a FixedSizedQueue with the specified maximum size. The maximum size must be 1 or more.

Parameters:
size - The maximum number of events the Queue can handle
Method Detail

size

public int size()
Deprecated. 

maxSize

public int maxSize()
Deprecated. 
Description copied from class: AbstractQueue
Default maxSize to -1 which is unbounded

Specified by:
maxSize in interface org.apache.excalibur.event.Sink
Overrides:
maxSize in class AbstractQueue
Returns:
the maximum number of elements

prepareEnqueue

public org.apache.excalibur.event.PreparedEnqueue prepareEnqueue(java.lang.Object[] elements)
                                                          throws org.apache.excalibur.event.SinkException
Deprecated. 
Throws:
org.apache.excalibur.event.SinkException

tryEnqueue

public boolean tryEnqueue(java.lang.Object element)
Deprecated. 

enqueue

public void enqueue(java.lang.Object[] elements)
             throws org.apache.excalibur.event.SinkException
Deprecated. 
Throws:
org.apache.excalibur.event.SinkException

enqueue

public void enqueue(java.lang.Object element)
             throws org.apache.excalibur.event.SinkException
Deprecated. 
Throws:
org.apache.excalibur.event.SinkException

dequeue

public java.lang.Object[] dequeue(int numElements)
Deprecated. 

addElement

private final void addElement(java.lang.Object element)
Deprecated. 

removeElement

private final java.lang.Object removeElement()
Deprecated. 

retrieveElements

private final java.lang.Object[] retrieveElements(int count)
Deprecated. 
Removes exactly 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.

Parameters:
count - number of elements to return
Returns:
requested number of elements

dequeueAll

public java.lang.Object[] dequeueAll()
Deprecated. 

dequeue

public java.lang.Object dequeue()
Deprecated.