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 IBlockingQueue
public void enqueue(Object o)
enqueue
in interface IBlockingQueue
o
- The element.public Object dequeue(long timeout) throws IBlockingQueue.ClosedException, IBlockingQueue.TimeoutException
dequeue
in interface IBlockingQueue
timeout
- the time to wait (in millis) or -1 for no timeout.IBlockingQueue.ClosedException
IBlockingQueue.TimeoutException
public Object dequeue()
dequeue
in interface IBlockingQueue
public void setClosed(boolean closed)
setClosed
in interface IBlockingQueue
closed
- The closed state.Copyright © 2012. All Rights Reserved.