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