|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.core.queue.FifoQueueImpl
This interface defines a queue that uses F irst In, F irst O ut semantics when adding and removing objects. Each object that is added to the queue is effectively placed at the end of the list of previous elements. Each call to
remove
will result
in the removal of the next element, or the oldest element in the queue.
Field Summary | |
private java.util.LinkedList |
m_delegate
The delegate list where queue elements are stored. |
Constructor Summary | |
FifoQueueImpl()
Constructs a new First In, First Out queue that can be used to exchange data. |
Method Summary | |
void |
add(java.lang.Object element)
Inserts a new element into the queue. |
boolean |
add(java.lang.Object element,
long timeout)
Inserts a new element into the queue. |
boolean |
isEmpty()
Used to test if the current queue has no stored elements. |
java.lang.Object |
remove()
Removes the oldest element from the queue. |
java.lang.Object |
remove(long timeout)
Removes the next element from the queue if one becomes available before the timeout expires. |
int |
size()
Returns the current number of elements that are in the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.LinkedList m_delegate
Constructor Detail |
public FifoQueueImpl()
Method Detail |
public void add(java.lang.Object element) throws FifoQueueException, java.lang.InterruptedException
add
in interface FifoQueue
element
- The object to append to the queue.
FifoQueueException
- Thrown if a queue error occurs.
java.lang.InterruptedException
- Thrown if the thread is interrupted.public boolean add(java.lang.Object element, long timeout) throws FifoQueueException, java.lang.InterruptedException
timeout
expires, then a false
value is returned to the caller.
add
in interface FifoQueue
element
- The object to append to the queue.timeout
- The time to wait on the insertion to succeed.
FifoQueueException
- Thrown if a queue error occurs.
java.lang.InterruptedException
- Thrown if the thread is interrupted.public java.lang.Object remove() throws FifoQueueException, java.lang.InterruptedException
remove
in interface FifoQueue
FifoQueueException
- Thrown if a queue error occurs.
java.lang.InterruptedException
- Thrown if the thread is interrupted.public java.lang.Object remove(long timeout) throws FifoQueueException, java.lang.InterruptedException
null
reference is returned to the caller.
remove
in interface FifoQueue
timeout
- The time to wait on an object to be available.
null
if one is
not available.
FifoQueueException
- Thrown if a queue error occurs.
java.lang.InterruptedException
- Thrown if the thread is interrupted.public int size()
size
in interface FifoQueue
public boolean isEmpty()
isEmpty
in interface FifoQueue
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |