org.exolab.jms.messagemgr
Interface DestinationCache

All Superinterfaces:
GarbageCollectable, MessageManagerEventListener
All Known Implementing Classes:
AbstractDestinationCache

public interface DestinationCache
extends MessageManagerEventListener, GarbageCollectable

A DestinationCache is used to cache messages for a particular destination.

It implements MessageManagerEventListener in order to be notified of messages being added to the MessageManager.

A ConsumerEndpoint registers with a DestinationCache to receive messages for a particular destination.

Version:
$Revision: 1.3 $ $Date: 2005/08/30 07:26:49 $
Author:
Jim Alateras, Tim Anderson

Method Summary
 boolean addConsumer(ConsumerEndpoint consumer)
          Register a consumer with this cache.
 boolean canDestroy()
          Determines if this cache can be destroyed.
 void destroy()
          Destroy this cache.
 JmsDestination getDestination()
          Returns the destination that messages are being cached for
 int getMessageCount()
          Returns the number of messages in the cache.
 boolean hasConsumers()
          Determines if the cache has any consumers.
 void removeConsumer(ConsumerEndpoint consumer)
          Remove the consumer for the list of registered consumers.
 void returnMessageHandle(MessageHandle handle)
          Return a message handle back to the cache, to recover unsent or unacknowledged messages.
 
Methods inherited from interface org.exolab.jms.messagemgr.MessageManagerEventListener
messageAdded, persistentMessageAdded
 
Methods inherited from interface org.exolab.jms.gc.GarbageCollectable
collectGarbage
 

Method Detail

getDestination

public JmsDestination getDestination()
Returns the destination that messages are being cached for
Returns:
the destination that messages are being cached for

addConsumer

public boolean addConsumer(ConsumerEndpoint consumer)
Register a consumer with this cache.
Parameters:
consumer - the message consumer for this destination
Returns:
true if registered; otherwise false

removeConsumer

public void removeConsumer(ConsumerEndpoint consumer)
Remove the consumer for the list of registered consumers.
Parameters:
consumer - the consumer to remove

hasConsumers

public boolean hasConsumers()
Determines if the cache has any consumers.
Returns:
true if the cache has consumers; otherwise false

returnMessageHandle

public void returnMessageHandle(MessageHandle handle)
Return a message handle back to the cache, to recover unsent or unacknowledged messages.
Parameters:
handle - the message handle to return

getMessageCount

public int getMessageCount()
Returns the number of messages in the cache.
Returns:
the number of messages in the cache

canDestroy

public boolean canDestroy()
Determines if this cache can be destroyed.
Returns:
true if the cache can be destroyed, otherwise false

destroy

public void destroy()
Destroy this cache.


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.