org.sapia.ubik.rmi.server.command
Class ExecQueue

java.lang.Object
  extended by org.sapia.ubik.rmi.server.command.ExecQueue
Direct Known Subclasses:
InQueue, OutQueue

public class ExecQueue
extends java.lang.Object

Models a queue of Executable instances.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Constructor Summary
ExecQueue()
          Constructor for CommandQueue.
 
Method Summary
 void add(Executable toExecute)
          Adds an Executable to this queue.
 Executable remove()
          Removes the first Executable from this queue and returns it.
 java.util.List removeAll()
          Removes all the Executable from this queue and returns them; if the queue is empty, this method blocks until a new item is added.
 void shutdown(long timeout)
          Shuts down this instance.
 int size()
          Returns this queue's size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecQueue

public ExecQueue()
Constructor for CommandQueue.

Method Detail

add

public void add(Executable toExecute)
Adds an Executable to this queue.

Parameters:
toExecute - an Executable.

removeAll

public java.util.List removeAll()
                         throws java.lang.InterruptedException,
                                ShutdownException
Removes all the Executable from this queue and returns them; if the queue is empty, this method blocks until a new item is added.

Returns:
a List of Executable.
Throws:
java.lang.InterruptedException
ShutdownException

shutdown

public void shutdown(long timeout)
              throws java.lang.InterruptedException
Shuts down this instance.

Parameters:
timeout - a timeout in millis. If this queue still has pending objects after the timeout is reached, this method returns.
Throws:
java.lang.InterruptedException

size

public int size()
Returns this queue's size.

Returns:
this queue's size (the number of items in this queue).

remove

public Executable remove()
                  throws java.lang.InterruptedException,
                         ShutdownException
Removes the first Executable from this queue and returns it.

Returns:
an Executable.
Throws:
java.lang.InterruptedException
ShutdownException


Copyright © 2010 Sapia OSS. All Rights Reserved.