org.apache.avalon.excalibur.event
Interface Sink

All Known Subinterfaces:
Queue

public interface Sink

A Sink implements the side of an event queue where QueueElements are dequeued operations only.

Author:
Berin Loritsch

Method Summary
 QueueElement dequeue()
          Dequeues the next element, or returns null if there is nothing left on the queue.
 QueueElement[] dequeue(int num)
          Dequeues at most num available elements, or returns null if there is nothing left on the queue.
 QueueElement[] dequeueAll()
          Dequeues all available elements, or returns null if there is nothing left on the queue.
 void setTimeout(long millis)
          Sets the timeout on a blocking Sink.
 int size()
          Returns the number of elements waiting in this queue.
 

Method Detail

setTimeout

public void setTimeout(long millis)
Sets the timeout on a blocking Sink. Values above 1 will force all dequeue operations to block for up to that number of milliseconds waiting for new elements. Values below 1 will turn off blocking for Sink. This is intentional because a Sink should never block indefinitely.

dequeue

public QueueElement dequeue()
Dequeues the next element, or returns null if there is nothing left on the queue.
Returns:
the next QueueElement on the queue

dequeueAll

public QueueElement[] dequeueAll()
Dequeues all available elements, or returns null if there is nothing left on the queue.
Returns:
all pending QueueElements on the queue

dequeue

public QueueElement[] dequeue(int num)
Dequeues at most num available elements, or returns null if there is nothing left on the queue.
Returns:
At most num QueueElements on the queue

size

public int size()
Returns the number of elements waiting in this queue.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.