|
Jadex 0.96-beta1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjadex.util.collection.BlockingQueue
public class BlockingQueue
A blocking queue allows to enqueue or dequeue elements. It blocks, when it is tried to dequeue an element, but the queue is empty.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface jadex.util.collection.IBlockingQueue |
---|
IBlockingQueue.ClosedException, IBlockingQueue.TimeoutException |
Constructor Summary | |
---|---|
BlockingQueue()
Create a blocking queue. |
Method Summary | |
---|---|
Object |
dequeue()
Dequeue an element. |
Object |
dequeue(long timeout)
Dequeue an element. |
void |
enqueue(Object element)
Enqueue an element. |
static void |
main(String[] args)
Main for testing. |
void |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BlockingQueue()
Method Detail |
---|
public void enqueue(Object element)
enqueue
in interface IBlockingQueue
element
- 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() throws IBlockingQueue.ClosedException
dequeue
in interface IBlockingQueue
IBlockingQueue.ClosedException
public void setClosed(boolean closed)
setClosed
in interface IBlockingQueue
closed
- The closed state.public int size()
size
in interface IBlockingQueue
public static void main(String[] args) throws InterruptedException
InterruptedException
public static void test1(String[] args) throws InterruptedException
InterruptedException
public static void test1b(String[] args) throws InterruptedException
InterruptedException
public static void test2(String[] args) throws InterruptedException
InterruptedException
|
Jadex 0.96-beta1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.