org.exolab.core.mipc
Class Queue

java.lang.Object
  extended by org.exolab.core.mipc.Queue

public class Queue
extends java.lang.Object

A simple FIFO Queue implementation that allows for concurrent access by consumers and producers. Remove()'s are blocking.

Version:
$Revision: 1.7 $
Author:
Art Whitten

Constructor Summary
Queue()
          Creates a new empty FIFO Queue.
 
Method Summary
 void add(java.lang.Object item)
          Push a new Object onto the bottom of the queue.
 void close()
          Close the queue.
 boolean isEmpty()
          Is the queue empty?
 java.lang.Object remove()
          Remove an Object from the top of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Creates a new empty FIFO Queue.

Method Detail

remove

public java.lang.Object remove()
                        throws java.lang.InterruptedException
Remove an Object from the top of the queue. This call blocks until an object is available.

Returns:
Object The next object available.
Throws:
java.lang.InterruptedException

add

public void add(java.lang.Object item)
Push a new Object onto the bottom of the queue. Any threads blocking for an object will be notified.

Parameters:
item - Add this object.

isEmpty

public boolean isEmpty()
Is the queue empty?

Returns:
boolean True if empty, otherwise False.

close

public void close()
Close the queue. If it is blocked then unblock it and release it so it can close correctly



Copyright © 1999-2012 The Exolab Group. All Rights Reserved.