org.jacorb.notification.queue
Class AbstractBoundedEventQueue
java.lang.Object
org.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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractBoundedEventQueue
protected AbstractBoundedEventQueue(int capacity,
EventQueueOverflowStrategy overflowStrategy,
java.lang.Object lock)
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 messageswait
- 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