public abstract class AbstractQueue
extends java.lang.Object
implements org.apache.excalibur.event.Queue
Queue types.| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.Object[] |
EMPTY_ARRAY
An empty array used as a return value when the Queue is empty
|
protected org.apache.excalibur.event.DequeueInterceptor |
m_interceptor |
protected org.apache.excalibur.event.EnqueuePredicate |
m_predicate |
protected long |
m_timeout
The number of milliseconds to wait
|
| Constructor and Description |
|---|
AbstractQueue() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
block(java.lang.Object lock)
Encapsulates the logic to block the
Queue for the amount
of time specified by the timeout. |
int |
canAccept()
Default for canAccept()
|
org.apache.excalibur.event.DequeueInterceptor |
getDequeueInterceptor()
Return the dequeue executable for this sink.
|
org.apache.excalibur.event.EnqueuePredicate |
getEnqueuePredicate()
Return the EnqueuePredicate that is already set for this Queue.
|
boolean |
isFull()
Check to see if the
Queue is full. |
int |
maxSize()
Default maxSize to -1 which is unbounded
|
void |
setDequeueInterceptor(org.apache.excalibur.event.DequeueInterceptor executable)
Set the dequeue executable for this sink.
|
void |
setEnqueuePredicate(org.apache.excalibur.event.EnqueuePredicate predicate)
Set the EnqueuePredicate to limit entries into this Queue.
|
void |
setTimeout(long millis)
Set the timeout for the
Queue in milliseconds. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected static final java.lang.Object[] EMPTY_ARRAY
protected long m_timeout
protected org.apache.excalibur.event.EnqueuePredicate m_predicate
protected org.apache.excalibur.event.DequeueInterceptor m_interceptor
public int canAccept()
canAccept in interface org.apache.excalibur.event.Sinkpublic int maxSize()
maxSize in interface org.apache.excalibur.event.Sinkpublic boolean isFull()
Queue is full. The method uses the
maxSize and size methods to determine
whether the queue is full.isFull in interface org.apache.excalibur.event.Sinkpublic void setTimeout(long millis)
Queue in milliseconds. The
default timeout is 0, which means that we don't wait at all.setTimeout in interface org.apache.excalibur.event.Sourcemillis - The number of milliseconds to block waiting for events to be enqueuedprotected void block(java.lang.Object lock)
Queue for the amount
of time specified by the timeout.lock - The object used as the mutex.public void setEnqueuePredicate(org.apache.excalibur.event.EnqueuePredicate predicate)
setEnqueuePredicate in interface org.apache.excalibur.event.Queuepublic org.apache.excalibur.event.EnqueuePredicate getEnqueuePredicate()
getEnqueuePredicate in interface org.apache.excalibur.event.Queuepublic void setDequeueInterceptor(org.apache.excalibur.event.DequeueInterceptor executable)
setDequeueInterceptor in interface org.apache.excalibur.event.Queueexecutable - The dequeue executable for this sink.public org.apache.excalibur.event.DequeueInterceptor getDequeueInterceptor()
getDequeueInterceptor in interface org.apache.excalibur.event.QueueDequeueInterceptor
The dequeue executable for this sink.