Class Queue
java.lang.Object
org.exoplatform.services.threadpool.impl.Queue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()Get an object from the front of the queue.get(long msecs) Get an object from the front of the queue.voidPut an object on the end of the queue.booleanPut an object on the end of the queue.voidsetMaxQueueSize(int newValue) Set the maximum queue size.
-
Constructor Details
-
Queue
public Queue()
-
-
Method Details
-
put
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:
InterruptedException
-
put
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 queuemsecs- 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:
InterruptedException
-
get
Get an object from the front of the queue. If queue is empty, waits until it is not empty.- Throws:
InterruptedException
-
get
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:
InterruptedException
-
setMaxQueueSize
public void setMaxQueueSize(int newValue) Set the maximum queue size.
-