org.exoplatform.services.threadpool.impl
Class Queue

java.lang.Object
  extended by org.exoplatform.services.threadpool.impl.Queue

public class Queue
extends java.lang.Object


Constructor Summary
Queue()
           
 
Method Summary
 java.lang.Object get()
          Get an object from the front of the queue.
 java.lang.Object get(long msecs)
          Get an object from the front of the queue.
 void put(java.lang.Object obj)
          Put an object on the end of the queue.
 boolean put(java.lang.Object obj, long msecs)
          Put an object on the end of the queue.
 void setMaxQueueSize(int newValue)
          Set the maximum queue size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Method Detail

put

public void put(java.lang.Object obj)
         throws java.lang.InterruptedException
Put an object on the end of the queue. If the size of the queue is equal to or greater than the current value of maxQueueSize then this method will wait until the size of the queue shrinks to less than maxQueueSize.

Parameters:
obj - the object to put at end of queue
Throws:
java.lang.InterruptedException

put

public boolean put(java.lang.Object obj,
                   long msecs)
            throws java.lang.InterruptedException
Put an object on the end of the queue. If the size of the queue is equal to or greater than the current value of maxQueueSize then this method will wait until the size of the queue shrinks to less than maxQueueSize.

Parameters:
obj - the object to put at end of queue
msecs - If this method has to wait for the size of the queue to shrink to less than maxQueueSize, it will stop waiting after it has waited this many milliseconds.
Returns:
false if this method returns without queuing the given object becuase it had to wait msec milliseconds; otherwise true.
Throws:
java.lang.InterruptedException

get

public java.lang.Object get()
                     throws java.lang.InterruptedException
Get an object from the front of the queue. If queue is empty, waits until it is not empty.

Throws:
java.lang.InterruptedException

get

public java.lang.Object get(long msecs)
                     throws java.lang.InterruptedException
Get an object from the front of the queue. If queue is empty, waits until it is not empty.

Parameters:
msecs - The maximum number of milliseconds that this method should wait before giving up.
Returns:
The object at the front of the queue or null if there are no objects in the queue and the method has waited at least the given number of milliseconds for an object to be put in the queue.
Throws:
java.lang.InterruptedException

setMaxQueueSize

public void setMaxQueueSize(int newValue)
Set the maximum queue size.



Copyright © 2012 eXo Platform SAS. All Rights Reserved.