org.jacorb.notification.queue
Class AbstractBoundedEventQueue

java.lang.Object
  extended byorg.jacorb.notification.queue.AbstractBoundedEventQueue
All Implemented Interfaces:
MessageQueue
Direct Known Subclasses:
AbstractBoundedEventHeap, BoundedFifoEventQueue

public abstract class AbstractBoundedEventQueue
extends java.lang.Object
implements MessageQueue

Version:
$Id: AbstractBoundedEventQueue.java,v 1.11 2006/02/25 15:28:40 alphonse.bendt Exp $
Author:
Alphonse Bendt

Nested Class Summary
 
Nested classes inherited from class org.jacorb.notification.queue.MessageQueue
MessageQueue.DiscardListener
 
Constructor Summary
protected AbstractBoundedEventQueue(int capacity, EventQueueOverflowStrategy overflowStrategy, java.lang.Object lock)
           
 
Method Summary
 void addDiscardListener(MessageQueue.DiscardListener listener)
           
protected abstract  void addElement(Message message)
           
protected abstract  Message[] getAllElements()
           
 Message[] getAllMessages(boolean wait)
          get all Messages from this queue.
 java.lang.String getDiscardPolicyName()
           
protected abstract  Message getEarliestTimeout()
           
protected abstract  Message[] getElements(int max)
           
protected abstract  Message getLeastPriority()
           
 Message getMessage(boolean wait)
          get the next Message from this queue. which particular event is selected depends on the underlying implementation.
 Message[] getMessages(int max, boolean wait)
          get up to n events from this queue.
protected abstract  Message getNextElement()
           
protected abstract  Message getOldestElement()
           
abstract  java.lang.String getOrderPolicyName()
           
protected abstract  Message getYoungestElement()
           
 void put(Message event)
          put a Message into this queue.
 void removeDiscardListener(MessageQueue.DiscardListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jacorb.notification.queue.MessageQueue
getSize, isEmpty
 

Constructor Detail

AbstractBoundedEventQueue

protected AbstractBoundedEventQueue(int capacity,
                                    EventQueueOverflowStrategy overflowStrategy,
                                    java.lang.Object lock)
Method Detail

getDiscardPolicyName

public final java.lang.String getDiscardPolicyName()
Specified by:
getDiscardPolicyName in interface MessageQueue

getEarliestTimeout

protected abstract Message getEarliestTimeout()

getLeastPriority

protected abstract Message getLeastPriority()

getNextElement

protected abstract Message getNextElement()

getOldestElement

protected abstract Message getOldestElement()

getYoungestElement

protected abstract Message getYoungestElement()

getElements

protected abstract Message[] getElements(int max)

addElement

protected abstract void addElement(Message message)

getAllElements

protected abstract Message[] getAllElements()

getOrderPolicyName

public abstract java.lang.String getOrderPolicyName()
Specified by:
getOrderPolicyName in interface MessageQueue

getAllMessages

public Message[] getAllMessages(boolean wait)
                         throws java.lang.InterruptedException
Description copied from interface: MessageQueue
get all Messages from this queue.

Specified by:
getAllMessages in interface MessageQueue
Parameters:
wait - a boolean value. If this parameter is set to true the queue will block until an element is available. If the parameter is set to false the queue will return null in case it is empty.
Throws:
java.lang.InterruptedException

getMessage

public Message getMessage(boolean wait)
                   throws java.lang.InterruptedException
Description copied from interface: MessageQueue
get the next Message from this queue. which particular event is selected depends on the underlying implementation.

Specified by:
getMessage in interface MessageQueue
Parameters:
wait - a boolean value. If this parameter is set to true the queue will block until an element is available. If the parameter is set to false the queue will return null in case it is empty.
Throws:
java.lang.InterruptedException

getMessages

public Message[] getMessages(int max,
                             boolean wait)
                      throws java.lang.InterruptedException
Description copied from interface: MessageQueue
get up to n events from this queue.

Specified by:
getMessages in interface MessageQueue
Parameters:
max - number of requested messages
wait - a boolean value. If this parameter is set to true the queue will block until an element is available. If the parameter is set to false the queue will return null in case it is empty.
Throws:
java.lang.InterruptedException

put

public void put(Message event)
Description copied from interface: MessageQueue
put a Message into this queue.

Specified by:
put in interface MessageQueue

addDiscardListener

public void addDiscardListener(MessageQueue.DiscardListener listener)
Specified by:
addDiscardListener in interface MessageQueue

removeDiscardListener

public void removeDiscardListener(MessageQueue.DiscardListener listener)
Specified by:
removeDiscardListener in interface MessageQueue