|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.excalibur.event.impl.AbstractQueue
Provides the base functionality for the other Queue
types.
Field Summary | |
protected static java.lang.Object[] |
EMPTY_ARRAY
An empty array used as a return value when the Queue is empty |
protected DequeueInterceptor |
m_interceptor
|
protected EnqueuePredicate |
m_predicate
|
protected long |
m_timeout
The number of milliseconds to wait |
Fields inherited from interface org.apache.excalibur.event.Queue |
ROLE |
Constructor Summary | |
AbstractQueue()
|
Method Summary | |
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() |
DequeueInterceptor |
getDequeueInterceptor()
Return the dequeue executable for this sink. |
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(DequeueInterceptor executable)
Set the dequeue executable for this sink. |
void |
setEnqueuePredicate(EnqueuePredicate predicate)
Set the EnqueuePredicate to limit entries into this Queue. |
void |
setTimeout(long millis)
Set the timeout for the Queue in milliseconds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.excalibur.event.Source |
dequeue, dequeue, dequeueAll, size |
Methods inherited from interface org.apache.excalibur.event.Sink |
enqueue, enqueue, prepareEnqueue, size, tryEnqueue |
Field Detail |
protected static final java.lang.Object[] EMPTY_ARRAY
protected long m_timeout
protected EnqueuePredicate m_predicate
protected DequeueInterceptor m_interceptor
Constructor Detail |
public AbstractQueue()
Method Detail |
public int canAccept()
canAccept
in interface Sink
public int maxSize()
maxSize
in interface Sink
public boolean isFull()
Queue
is full. The method uses the
maxSize
and size
methods to determine
whether the queue is full.
isFull
in interface Sink
public void setTimeout(long millis)
Queue
in milliseconds. The
default timeout is 0, which means that we don't wait at all.
setTimeout
in interface Source
millis
- 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(EnqueuePredicate predicate)
setEnqueuePredicate
in interface Queue
predicate
- the enqueue predicate for this sinkpublic EnqueuePredicate getEnqueuePredicate()
getEnqueuePredicate
in interface Queue
EnqueuePredicate
the enqueue predicate for this sink.public void setDequeueInterceptor(DequeueInterceptor executable)
setDequeueInterceptor
in interface Queue
executable
- The dequeue executable for this sink.public DequeueInterceptor getDequeueInterceptor()
getDequeueInterceptor
in interface Queue
DequeueInterceptor
The dequeue executable for this sink.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |