|
||||||||||
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 managerMethod Detail |
public JmsDestination getDestination()
getDestination
in interface DestinationCache
public boolean addConsumer(ConsumerEndpoint consumer)
addConsumer
in interface DestinationCache
consumer
- the message consumer for this destinationtrue
if registered; otherwise false
public void removeConsumer(ConsumerEndpoint consumer)
removeConsumer
in interface DestinationCache
consumer
- the consumer to removepublic boolean hasConsumers()
hasConsumers
in interface DestinationCache
true
if the cache has consumers; otherwise
false
public int getMessageCount()
getMessageCount
in interface DestinationCache
public boolean canDestroy()
true
if there are no active consumers.canDestroy
in interface DestinationCache
true
if the cache can be destroyed, otherwise
false
public void destroy()
destroy
in interface DestinationCache
public void onLeaseExpired(java.lang.Object object)
onLeaseExpired
in interface LeaseEventListenerIfc
object
- an instance of MessageRef
public void collectGarbage(boolean aggressive)
GarbageCollectable
collectGarbage
in interface GarbageCollectable
org.exolab.jms.gc.GarbageCollectable
aggressive
- true
for aggressive garbage collectionprotected 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 errorprotected 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 problemprotected 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 accessedprotected 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 |