public class BlockingQueue extends Object implements IBlockingQueue
IBlockingQueue.ClosedException| Constructor and Description |
|---|
BlockingQueue()
Create a blocking queue.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
dequeue()
Dequeue an element.
|
Object |
dequeue(long timeout)
Dequeue an element.
|
void |
enqueue(Object element)
Enqueue an element.
|
boolean |
isClosed()
Check if the queue is closed.
|
static void |
main(String[] args)
Main for testing.
|
List |
setClosed(boolean closed)
Open/close the queue.
|
int |
size()
Return the size of the queue.
|
static void |
test1(String[] args)
Main for testing.
|
static void |
test1b(String[] args)
Main for testing.
|
static void |
test2(String[] args)
Main for testing.
|
public void enqueue(Object element)
enqueue in interface IBlockingQueueelement - The element.public Object dequeue(long timeout) throws IBlockingQueue.ClosedException, TimeoutException
dequeue in interface IBlockingQueuetimeout - the time to wait (in millis) or -1 for no timeout.IBlockingQueue.ClosedExceptionTimeoutExceptionpublic Object dequeue() throws IBlockingQueue.ClosedException
dequeue in interface IBlockingQueueIBlockingQueue.ClosedExceptionpublic boolean isClosed()
isClosed in interface IBlockingQueuepublic List setClosed(boolean closed)
setClosed in interface IBlockingQueueclosed - The closed state.public int size()
size in interface IBlockingQueuepublic static void main(String[] args) throws InterruptedException
InterruptedExceptionpublic static void test1(String[] args) throws InterruptedException
InterruptedExceptionpublic static void test1b(String[] args) throws InterruptedException
InterruptedExceptionpublic static void test2(String[] args) throws InterruptedException
InterruptedExceptionCopyright © 2012. All Rights Reserved.