Queue
class represents a first-in-first-out (FIFO) queue of objects.
Definition at line 44 of file Queue.java.
Public Member Functions | |
Queue (int size) | |
Constructs an Queue with the specifies maximum size. | |
synchronized void | insert (Object item) throws IndexOutOfBoundsException |
Inserts an item into the queue. | |
synchronized void | insertFirst (Object item) |
Inserts an item first into the queue. | |
synchronized Object | removeWait (float timeout) |
Removes and returns the first item in the queue. | |
Object | remove () |
Removes and returns the first object in the queue. | |
synchronized void | close () |
Closes the queue, i.e. |
org.knopflerfish.framework.Queue.Queue | ( | int | size | ) |
Constructs an Queue with the specifies maximum size.
size | maximum queue size. |
Definition at line 54 of file Queue.java.
synchronized void org.knopflerfish.framework.Queue.insert | ( | Object | item | ) | throws IndexOutOfBoundsException |
Inserts an item into the queue.
If there are threads blocked on remove
, one of them is unblocked.
item | the item to be inserted. |
IndexOutOfBoundsException | if maximum queue size is reached. |
Definition at line 67 of file Queue.java.
synchronized void org.knopflerfish.framework.Queue.insertFirst | ( | Object | item | ) |
Inserts an item first into the queue.
If there are threads blocked on remove
, one of them is unblocked.
item | the item to be inserted. |
Definition at line 84 of file Queue.java.
synchronized Object org.knopflerfish.framework.Queue.removeWait | ( | float | timeout | ) |
Removes and returns the first item in the queue.
If the queue is empty, the calling thread will block.
timeout | timeout in seconds. |
null
if a timeout occurred. To distinguish timeouts, null
items should not be inserted in the queue. Definition at line 100 of file Queue.java.
Referenced by org.knopflerfish.framework.Queue.remove().
Object org.knopflerfish.framework.Queue.remove | ( | ) |
Removes and returns the first object in the queue.
Same as remove(float timeout)
but this function blocks forever.
Definition at line 134 of file Queue.java.
References org.knopflerfish.framework.Queue.removeWait().
synchronized void org.knopflerfish.framework.Queue.close | ( | ) |
Closes the queue, i.e.
wakes up all threads blocking on a call to remove().
Definition at line 146 of file Queue.java.