OpenNMS API 1.2.3

org.opennms.netmgt.scheduler
Class Scheduler.PeekableFifoQueue

java.lang.Object
  extended byorg.opennms.core.queue.FifoQueueImpl
      extended byorg.opennms.netmgt.scheduler.Scheduler.PeekableFifoQueue
All Implemented Interfaces:
FifoQueue
Enclosing class:
Scheduler

public static final class Scheduler.PeekableFifoQueue
extends FifoQueueImpl

This queue extends the standard FIFO queue instance so that it is possible to peek at an instance without removing it from the queue.


Field Summary
private  java.lang.Object m_hold
          The object hold.
 
Fields inherited from class org.opennms.core.queue.FifoQueueImpl
 
Constructor Summary
(package private) Scheduler.PeekableFifoQueue()
          Default constructor.
 
Method Summary
 java.lang.Object peek()
          This method allows the caller to peek at the next object that would be returned on a remove call.
 java.lang.Object remove()
          Removes the next element from the queue and returns it to the caller.
 java.lang.Object remove(long timeout)
          Removes the next element from the queue and returns it to the caller.
 
Methods inherited from class org.opennms.core.queue.FifoQueueImpl
add, add, isEmpty, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_hold

private java.lang.Object m_hold
The object hold. This holds the last object peeked at by the application.

Constructor Detail

Scheduler.PeekableFifoQueue

Scheduler.PeekableFifoQueue()
Default constructor.

Method Detail

peek

public java.lang.Object peek()
                      throws java.lang.InterruptedException,
                             FifoQueueException
This method allows the caller to peek at the next object that would be returned on a remove call. If the queue is currently empty then the caller is blocked until an object is put into the queue.

Returns:
The object that would be returned on the next call to remove.
Throws:
java.lang.InterruptedException - Thrown if the thread is interrupted.
FifoQueueException - Thrown if an error occurs removing an item from the queue.

remove

public java.lang.Object remove()
                        throws java.lang.InterruptedException,
                               FifoQueueException
Removes the next element from the queue and returns it to the caller. If there is no objects available then the caller is blocked until an item is available.

Specified by:
remove in interface FifoQueue
Overrides:
remove in class FifoQueueImpl
Returns:
The next element in the queue.
Throws:
java.lang.InterruptedException - Thrown if the thread is interrupted.
FifoQueueException - Thrown if an error occurs removing an item from the queue.

remove

public java.lang.Object remove(long timeout)
                        throws java.lang.InterruptedException,
                               FifoQueueException
Removes the next element from the queue and returns it to the caller. If there is no objects available then the caller is blocked until an item is available. If an object is not available within the time frame specified by timeout.

Specified by:
remove in interface FifoQueue
Overrides:
remove in class FifoQueueImpl
Parameters:
timeout - The maximum time to wait.
Returns:
The next element in the queue.
Throws:
java.lang.InterruptedException - Thrown if the thread is interrupted.
FifoQueueException - Thrown if an error occurs removing an item from the queue.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.