seda.sandStorm.api
Interface SourceIF

All Known Subinterfaces:
QueueIF, SelectSourceIF
All Known Implementing Classes:
EventSink, FiniteQueue, NIOSelectSource, SelectSource

public interface SourceIF

A SourceIF implements the 'source side' of an event queue: it supports dequeue operations only.


Method Summary
 QueueElementIF[] blocking_dequeue_all(int timeout_millis)
          This method blocks on the queue up until a timeout occurs or until an element appears on the queue.
 QueueElementIF blocking_dequeue(int timeout_millis)
          Just like blocking_dequeue_all, but returns only a single element.
 QueueElementIF[] blocking_dequeue(int timeout_millis, int num)
          This method blocks on the queue up until a timeout occurs or until an element appears on the queue.
 QueueElementIF[] dequeue_all()
          Dequeues all available elements, or returns null if there is nothing left on the queue.
 QueueElementIF dequeue()
          Dequeues the next element, or returns null if there is nothing left on the queue.
 QueueElementIF[] dequeue(int num)
          Dequeues at most num available elements, or returns null if there is nothing left on the queue.
 int size()
          Returns the number of elements waiting in this queue.
 

Method Detail

dequeue

QueueElementIF dequeue()
Dequeues the next element, or returns null if there is nothing left on the queue.

Returns:
the next QueueElementIF on the queue

dequeue_all

QueueElementIF[] dequeue_all()
Dequeues all available elements, or returns null if there is nothing left on the queue.

Returns:
all pending QueueElementIFs on the queue

dequeue

QueueElementIF[] dequeue(int num)
Dequeues at most num available elements, or returns null if there is nothing left on the queue.

Returns:
At most num QueueElementIFs on the queue

blocking_dequeue

QueueElementIF blocking_dequeue(int timeout_millis)
Just like blocking_dequeue_all, but returns only a single element.


blocking_dequeue_all

QueueElementIF[] blocking_dequeue_all(int timeout_millis)
This method blocks on the queue up until a timeout occurs or until an element appears on the queue. It returns all elements waiting on the queue at that time.

Parameters:
timeout_millis - if timeout_millis is 0, this method will be non-blocking and will return right away, whether or not any elements are pending on the queue. If timeout_millis is -1, this method blocks forever until something is available. If timeout_millis is positive, this method will wait about that number of milliseconds before returning, but possibly a little more.
Returns:
an array of QueueElementIF's. This array will be null if no elements were pending.

blocking_dequeue

QueueElementIF[] blocking_dequeue(int timeout_millis,
                                  int num)
This method blocks on the queue up until a timeout occurs or until an element appears on the queue. It returns at most num elements waiting on the queue at that time.


size

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