jrun.jms.core.messagemgr
Class QueueDestinationCache

java.lang.Object
  |
  +--jrun.jms.core.messagemgr.DestinationCache
        |
        +--jrun.jms.core.messagemgr.QueueDestinationCache
All Implemented Interfaces:
Identifiable, MessageManagerEventListener, SchedulableEventListener, java.io.Serializable

public class QueueDestinationCache
extends DestinationCache

A DestinationCache for Queues

Version:
$Revision: 1.11 $ $Date: 2001/10/12 07:55:31 $
Author:
Jim Alateras
See Also:
Serialized Form

Fields inherited from class jrun.jms.core.messagemgr.DestinationCache
_consumers, _leaseHelper, _messages, m_persistentAdapter
 
Method Summary
 void addQueueListener(QueueListener listener)
          A Queue can also hav a queue listener, which simply gets informed of all messages that arrive at this destination
 JmsDestination getDestination()
          Return a reference to the underlying destination
 MessageHandle getMessage(QueueConsumerEndpoint endpoint)
          Return the first message of the queue or null if there are no messages in the cache
 int getMessageCount()
          Return the number of messages currently active for this destination
 int hashCode()
           
 boolean messageAdded(JmsDestination destination, MessageImpl message)
          This method is called when the #MessageManager adds a message for this destination to the cache
 void messageRemoved(JmsDestination destination, MessageImpl message)
          This method is called when the #MessageManager removes a message from the cache.
 boolean persistentMessageAdded(JmsDestination destination, MessageImpl message)
          This event is called when the MessageMgr adds a persistent message to the cache.
 void persistentMessageRemoved(JmsDestination destination, MessageImpl message)
          This method is called when the {@l;ink #MessageManager} removes a persistent message from the cache.
 void playbackMessages(QueueListener listener)
          Playback all the messages in the cache to the specified QueueListener
 void removeQueueListener(QueueListener listener)
          Remove the queue listener associated with this cache
 void returnMessage(MessageHandle handle, boolean notifyListeners)
          Return the specified message to top of the queue.
 java.lang.String toString()
           
 
Methods inherited from class jrun.jms.core.messagemgr.DestinationCache
getConsumers, getDestinationByName, getId, getIdAsString, getLogger, getMaximumSize, onLeaseExpired, onSchedulableEvent, registerConsumer, setCacheEvictionPolicy, setMaximumSize, shutdown, unregisterConsumer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getDestination

public JmsDestination getDestination()
Description copied from class: DestinationCache
Return a reference to the underlying destination
Overrides:
getDestination in class DestinationCache
Following copied from class: jrun.jms.core.messagemgr.DestinationCache
Returns:
JmsDestination

addQueueListener

public void addQueueListener(QueueListener listener)
A Queue can also hav a queue listener, which simply gets informed of all messages that arrive at this destination
Parameters:
listener - - queue listener

removeQueueListener

public void removeQueueListener(QueueListener listener)
Remove the queue listener associated with this cache
Parameters:
listener - - queue listener to remove

messageAdded

public boolean messageAdded(JmsDestination destination,
                            MessageImpl message)
Description copied from class: DestinationCache
This method is called when the #MessageManager adds a message for this destination to the cache
Overrides:
messageAdded in class DestinationCache
Following copied from class: jrun.jms.core.messagemgr.DestinationCache
Parameters:
message - - message added to cache

messageRemoved

public void messageRemoved(JmsDestination destination,
                           MessageImpl message)
This method is called when the #MessageManager removes a message from the cache.
Overrides:
messageRemoved in class DestinationCache
Parameters:
destination - - the message destination
message - - message removed from cache

persistentMessageAdded

public boolean persistentMessageAdded(JmsDestination destination,
                                      MessageImpl message)
                               throws PersistenceException
Description copied from interface: MessageManagerEventListener
This event is called when the MessageMgr adds a persistent message to the cache.
Following copied from interface: jrun.jms.core.messagemgr.MessageManagerEventListener
Parameters:
destination - - the message's destination
message - - message added to cache
Returns:
boolean - true if the message was accepted
Throws:
PersistenceException - - if there is a persistence related problem

persistentMessageRemoved

public void persistentMessageRemoved(JmsDestination destination,
                                     MessageImpl message)
                              throws PersistenceException
Description copied from class: DestinationCache
This method is called when the {@l;ink #MessageManager} removes a persistent message from the cache.
Overrides:
persistentMessageRemoved in class DestinationCache
Following copied from class: jrun.jms.core.messagemgr.DestinationCache
Parameters:
message - - message removed from cache

getMessageCount

public int getMessageCount()
Description copied from class: DestinationCache
Return the number of messages currently active for this destination
Overrides:
getMessageCount in class DestinationCache
Following copied from class: jrun.jms.core.messagemgr.DestinationCache
Returns:
int - number of active messages

getMessage

public MessageHandle getMessage(QueueConsumerEndpoint endpoint)
Return the first message of the queue or null if there are no messages in the cache
Parameters:
QueueConsumerEndpoint - - the consumer who will receive the message
Returns:
MessageHandle - handle to the first message

playbackMessages

public void playbackMessages(QueueListener listener)
Playback all the messages in the cache to the specified QueueListener
Parameters:
listener - - the queue listener

returnMessage

public void returnMessage(MessageHandle handle,
                          boolean notifyListeners)
Return the specified message to top of the queue. This is called to recover unsent or unacked messages
Parameters:
message - - message to return

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright � 2002 Macromedia Corporation. All Rights Reserved.