public class Queue extends Object
| Constructor and Description |
|---|
Queue(int size) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object obj)
This method blocks until space is available in this queue.
|
void |
close()
closes this queue.
|
boolean |
isClosed() |
boolean |
isEmpty() |
boolean |
isFull() |
Object |
remove()
This method blocks until some element is added to this queue, or the queue
is closed.
|
int |
remove(List collector,
int count)
Removes multiple elements.
|
int |
size() |
public final int size()
maximum size of this queue.public final boolean isClosed()
close()public void close()
add(Object) method calls will
fail. All #get() operations will succeed until the queue is
empty. This method may be called multiple times.isClosed()public final boolean isFull()
add(Object)
would block.public final boolean isEmpty()
#get()
would block.public void add(Object obj) throws InterruptedException, IllegalStateException
obj - the Object to add to the end of this queue. null is permitted.InterruptedException - if the current thread is interrupted.IllegalStateException - if queue is closed.close(),
remove()public Object remove() throws InterruptedException, IllegalStateException
add(Object)InterruptedException - if the current thread is interrupted.IllegalStateException - if queue is closed.close(),
add(Object),
#remove(LIst,int)public int remove(List collector, int count) throws InterruptedException, IllegalStateException
collector - all the elements removed from this queue are added to
the end of this List.count - the maximum number of elements to remove. If this is zero,
then it defaults to the maximum size of this queue.InterruptedExceptionIllegalStateExceptionremove()Copyright © 2001-2012 Apache Software Foundation. All Rights Reserved.