com.waveset.util
Class BlockingQueue

java.lang.Object
  extended bycom.waveset.util.Queue
      extended bycom.waveset.util.SynchronizedQueue
          extended bycom.waveset.util.BlockingQueue

public class BlockingQueue
extends SynchronizedQueue


Field Summary
protected  Semaphore _waitForItemToBeRead
           
static java.lang.String code_id
           
protected static Trace trace
           
 
Constructor Summary
BlockingQueue()
           
 
Method Summary
 java.lang.Object dequeue()
           
 java.lang.Object dequeue(boolean waitIfEmpty)
           
 void enqueue(java.lang.Object obj)
          Add the specified item to the back of the queue.
static void main(java.lang.String[] args)
           
 void notifyAllWaiters()
          Notify all of the callers waiting to dequeue.
 java.lang.Object waitToDequeue()
           
 java.lang.Object waitToDequeue(long timeout)
           
 void waitToEnqueue(java.lang.Object obj, int queueSizeLimit)
          Add the specified item to the back of the queue.
 
Methods inherited from class com.waveset.util.SynchronizedQueue
clear, findEquivalent, peek, poke, remove
 
Methods inherited from class com.waveset.util.Queue
isEmpty, preview, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

trace

protected static final Trace trace

_waitForItemToBeRead

protected Semaphore _waitForItemToBeRead
Constructor Detail

BlockingQueue

public BlockingQueue()
Method Detail

waitToDequeue

public java.lang.Object waitToDequeue()
                               throws java.lang.InterruptedException
Returns:
the next item from the front of the queue. If the queue is empty, this method blocks until the caller is notified or interrupted.
Throws:
java.lang.InterruptedException

waitToDequeue

public java.lang.Object waitToDequeue(long timeout)
                               throws java.lang.InterruptedException
Returns:
the next item from the front of the queue. If the queue is empty, this method blocks until the caller is notified or interrupted or the timeout expires.
Throws:
java.lang.InterruptedException

dequeue

public java.lang.Object dequeue(boolean waitIfEmpty)
                         throws java.lang.InterruptedException
Overrides:
dequeue in class SynchronizedQueue
Parameters:
waitIfEmpty - if true, causes the method to block until the caller is notified or interrupted.
Returns:
the next item from the front of the queue.
Throws:
java.lang.InterruptedException - if the thread is interrupted while waiting.

dequeue

public java.lang.Object dequeue()
Overrides:
dequeue in class Queue
Returns:
the next item from the front of the queue.

waitToEnqueue

public void waitToEnqueue(java.lang.Object obj,
                          int queueSizeLimit)
                   throws java.lang.InterruptedException
Add the specified item to the back of the queue. If the queue is larger than @param queueSizeLimit, this method blocks until the caller is notified or the caller is interrupted.

Throws:
java.lang.InterruptedException

enqueue

public void enqueue(java.lang.Object obj)
Add the specified item to the back of the queue. Notify one of the callers waiting to dequeue.

Overrides:
enqueue in class SynchronizedQueue

notifyAllWaiters

public void notifyAllWaiters()
Notify all of the callers waiting to dequeue.


main

public static void main(java.lang.String[] args)