|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.exolab.jms.messagemgr.AbstractDestinationCache
Abstract implementation of the DestinationCache interface.
| Constructor Summary | |
AbstractDestinationCache(JmsDestination destination,
DatabaseService database,
LeaseManager leases)
Construct a new AbstractDestinationCache. |
|
| Method Summary | |
boolean |
addConsumer(ConsumerEndpoint consumer)
Register a consumer with this cache. |
protected void |
addMessage(MessageRef reference,
MessageImpl message)
Add a message reference and its corresponding message to the cache |
boolean |
canDestroy()
Determines if this cache can be destroyed. |
protected void |
checkMessageExpiry(MessageRef reference,
long expiryTime)
Check to see if the message has a TTL. |
protected void |
checkMessageExpiry(MessageRef reference,
MessageImpl message)
Check to see if the message has a TTL. |
void |
collectGarbage(boolean aggressive)
Perform any garbage collection on this resource. |
void |
destroy()
Destroy this cache. |
protected ConsumerEndpoint[] |
getConsumerArray()
Helper to return the consumers as an array. |
protected ConsumerEndpoint |
getConsumerEndpoint(long consumerId)
Returns a consumer endpoint, given its id. |
JmsDestination |
getDestination()
Returns the destination that messages are being cached for. |
protected org.exolab.jms.messagemgr.DefaultMessageCache |
getMessageCache()
Returns the message cache. |
int |
getMessageCount()
Returns the number of messages in the cache. |
boolean |
hasConsumers()
Determines if the cache has any consumers. |
protected void |
messageExpired(MessageRef reference)
Remove an expired non-peristent message, and notify any listeners. |
void |
onLeaseExpired(java.lang.Object object)
Invoked when a message lease has expired. |
protected void |
persistentMessageExpired(MessageRef reference)
Remove an expired persistent message, and notify any listeners. |
void |
removeConsumer(ConsumerEndpoint consumer)
Remove the consumer for the list of registered consumers. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.exolab.jms.messagemgr.DestinationCache |
returnMessageHandle |
| Methods inherited from interface org.exolab.jms.messagemgr.MessageManagerEventListener |
messageAdded, persistentMessageAdded |
| Constructor Detail |
public AbstractDestinationCache(JmsDestination destination,
DatabaseService database,
LeaseManager leases)
AbstractDestinationCache.destination - the destination to cache messages fordatabase - the database serviceleases - the lease manager| Method Detail |
public JmsDestination getDestination()
getDestination in interface DestinationCachepublic boolean addConsumer(ConsumerEndpoint consumer)
addConsumer in interface DestinationCacheconsumer - the message consumer for this destinationtrue if registered; otherwise falsepublic void removeConsumer(ConsumerEndpoint consumer)
removeConsumer in interface DestinationCacheconsumer - the consumer to removepublic boolean hasConsumers()
hasConsumers in interface DestinationCachetrue if the cache has consumers; otherwise
falsepublic int getMessageCount()
getMessageCount in interface DestinationCachepublic boolean canDestroy()
true if there are no active consumers.canDestroy in interface DestinationCachetrue if the cache can be destroyed, otherwise
falsepublic void destroy()
destroy in interface DestinationCachepublic void onLeaseExpired(java.lang.Object object)
onLeaseExpired in interface LeaseEventListenerIfcobject - an instance of MessageRefpublic void collectGarbage(boolean aggressive)
GarbageCollectablecollectGarbage in interface GarbageCollectableorg.exolab.jms.gc.GarbageCollectableaggressive - true for aggressive garbage collection
protected void addMessage(MessageRef reference,
MessageImpl message)
reference - the reference to the messagemessage - the messageprotected org.exolab.jms.messagemgr.DefaultMessageCache getMessageCache()
protected ConsumerEndpoint getConsumerEndpoint(long consumerId)
consumerId - the consumer identityid, or
null if none is registeredprotected ConsumerEndpoint[] getConsumerArray()
protected void messageExpired(MessageRef reference)
throws javax.jms.JMSException
reference - the reference to the expired messagejavax.jms.JMSException - for any error
protected void persistentMessageExpired(MessageRef reference)
throws javax.jms.JMSException,
PersistenceException
reference - the reference to the expired messagejavax.jms.JMSException - if a listener fails to handle the
expirationPersistenceException - if there is a persistence related problem
protected void checkMessageExpiry(MessageRef reference,
MessageImpl message)
throws javax.jms.JMSException
reference - a reference to the messagemessage - the messagejavax.jms.JMSException - if the JMSExpiration property can't be accessed
protected void checkMessageExpiry(MessageRef reference,
long expiryTime)
reference - a reference to the messageexpiryTime - the time when the message expires
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||