solar.util
Class JavaSyncQueue

java.lang.Object
  |
  +--solar.util.JavaSyncQueue
All Implemented Interfaces:
Queue

public class JavaSyncQueue
extends java.lang.Object
implements Queue

A synchronized blocking queue based on a Java linked-list.

Version:
$Id: JavaSyncQueue.java,v 1.2 2003/09/09 21:24:50 glchen Exp $
Author:
Guanling Chen

Field Summary
protected  java.util.LinkedList _list
           
protected  int _size
           
 
Constructor Summary
JavaSyncQueue()
           
 
Method Summary
 java.lang.Object dequeue()
          Dequeue one data item.
 java.lang.Object dequeue(long timeout)
          Dequeue one data item within timeout period.
 java.lang.Object[] dequeueAll()
          Dequeue all the data items currently in the queue.
 void enqueue(java.lang.Object item)
          Enqueue one data item.
 void enqueueAll(java.lang.Object[] items)
          Enqueue an array of data items.
 int size()
          Return the size of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_list

protected java.util.LinkedList _list

_size

protected int _size
Constructor Detail

JavaSyncQueue

public JavaSyncQueue()
Method Detail

size

public int size()
Description copied from interface: Queue
Return the size of the queue.

Specified by:
size in interface Queue

enqueue

public void enqueue(java.lang.Object item)
Description copied from interface: Queue
Enqueue one data item.

Specified by:
enqueue in interface Queue

enqueueAll

public void enqueueAll(java.lang.Object[] items)
Description copied from interface: Queue
Enqueue an array of data items.

Specified by:
enqueueAll in interface Queue

dequeue

public java.lang.Object dequeue()
                         throws java.lang.InterruptedException
Description copied from interface: Queue
Dequeue one data item.

Specified by:
dequeue in interface Queue
java.lang.InterruptedException

dequeue

public java.lang.Object dequeue(long timeout)
                         throws java.lang.InterruptedException
Description copied from interface: Queue
Dequeue one data item within timeout period.

Specified by:
dequeue in interface Queue
java.lang.InterruptedException

dequeueAll

public java.lang.Object[] dequeueAll()
Description copied from interface: Queue
Dequeue all the data items currently in the queue.

Specified by:
dequeueAll in interface Queue