public class ArrayBlockingQueue<T> extends Object implements IBlockingQueue<T>
IBlockingQueue.ClosedException| Constructor and Description |
|---|
ArrayBlockingQueue()
Create a new blocking queue.
|
| Modifier and Type | Method and Description |
|---|---|
T |
dequeue()
Remove an object from the queue
(blocks until an element is available).
|
T |
dequeue(long timeout)
Dequeue an element.
|
void |
enqueue(Object o)
Add an element to the end of the queue.
|
boolean |
isClosed()
Check if the queue is closed.
|
List<T> |
setClosed(boolean closed)
Open/close the queue.
|
int |
size()
Get the number of elements in the queue.
|
public int size()
size in interface IBlockingQueue<T>public void enqueue(Object o)
enqueue in interface IBlockingQueue<T>o - The element.public T dequeue(long timeout) throws IBlockingQueue.ClosedException, TimeoutException
dequeue in interface IBlockingQueue<T>timeout - the time to wait (in millis) or -1 for no timeout.IBlockingQueue.ClosedExceptionTimeoutExceptionpublic T dequeue()
dequeue in interface IBlockingQueue<T>public List<T> setClosed(boolean closed)
setClosed in interface IBlockingQueue<T>closed - The closed state.public boolean isClosed()
isClosed in interface IBlockingQueue<T>Copyright © 2012. All Rights Reserved.