|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.messagemgr.AbstractDestinationCache | +--org.exolab.jms.messagemgr.QueueDestinationCache
A DestinationCache
for queues.
Constructor Summary | |
QueueDestinationCache(JmsQueue queue,
DatabaseService database,
LeaseManager leases,
ServerConnectionManager connections)
Construct a new QueueDestinationCache . |
Method Summary | |
protected void |
addMessage(MessageRef reference,
MessageImpl message,
MessageHandle handle)
Add a message, and notify any listeners. |
void |
addQueueListener(QueueBrowserEndpoint listener)
A Queue can also hav a queue listener, which simply gets informed of all messages that arrive at this destination. |
boolean |
canDestroy()
Determines if this cache can be destroyed. |
void |
destroy()
Destroy this object. |
MessageHandle |
getMessage(Selector selector,
Condition cancel)
Returns the first available message matching the supplied message selector. |
int |
getMessageCount()
Returns the number of messages in the cache. |
boolean |
hasConsumers()
Determines if there are any registered consumers. |
protected void |
init()
Initialise the cache. |
void |
messageAdded(JmsDestination destination,
MessageImpl message)
Invoked when the MessageMgr receives a non-persistent message. |
protected void |
messageExpired(MessageRef reference)
Remove an expired non-peristent message, and notify any listeners. |
protected void |
notifyQueueListeners(MessageHandle handle,
MessageImpl message)
Notify queue browsers that a message has arrived. |
void |
persistentMessageAdded(JmsDestination destination,
MessageImpl message)
Invoked when the MessageMgr receives a persistent message. |
protected void |
persistentMessageExpired(MessageRef reference)
Remove an expired persistent message, and notify any listeners. |
void |
playbackMessages(QueueBrowserEndpoint browser)
Playback all the messages in the cache to the specified QueueBrowserEndpoint . |
void |
removeQueueListener(QueueBrowserEndpoint listener)
Remove the queue listener associated with this cache |
void |
returnMessageHandle(MessageHandle handle)
Return a message handle back to the cache, to recover unsent or unacknowledged messages. |
Methods inherited from class org.exolab.jms.messagemgr.AbstractDestinationCache |
addConsumer, addMessage, checkMessageExpiry, checkMessageExpiry, collectGarbage, getConsumerArray, getConsumerEndpoint, getDestination, getMessageCache, onLeaseExpired, removeConsumer |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QueueDestinationCache(JmsQueue queue, DatabaseService database, LeaseManager leases, ServerConnectionManager connections) throws javax.jms.JMSException
QueueDestinationCache
.queue
- the queue to cache messages fordatabase
- the database serviceleases
- the lease managerconnections
- the connection managerjavax.jms.JMSException
- if the cache can't be initialisedMethod Detail |
public void addQueueListener(QueueBrowserEndpoint listener)
listener
- - queue listenerpublic void removeQueueListener(QueueBrowserEndpoint listener)
listener
- - queue listener to removepublic void messageAdded(JmsDestination destination, MessageImpl message) throws javax.jms.JMSException
MessageMgr
receives a non-persistent message.destination
- the message's destinationmessage
- the messagejavax.jms.JMSException
- if the listener fails to handle the messagepublic void persistentMessageAdded(JmsDestination destination, MessageImpl message) throws javax.jms.JMSException, PersistenceException
MessageMgr
receives a persistent message.destination
- the message's destinationmessage
- the messagejavax.jms.JMSException
- if the listener fails to handle the messagePersistenceException
- if there is a persistence related problempublic MessageHandle getMessage(Selector selector, Condition cancel) throws javax.jms.JMSException
selector
- the message selector to use. May be null
cancel
- null
if there are no
messages, or none matching selector
javax.jms.JMSException
- for any errorpublic void playbackMessages(QueueBrowserEndpoint browser) throws javax.jms.JMSException
QueueBrowserEndpoint
.browser
- the queue browserjavax.jms.JMSException
- for any errorpublic void returnMessageHandle(MessageHandle handle)
handle
- the message handle to returnpublic boolean hasConsumers()
hasConsumers
in class AbstractDestinationCache
true
if there are registered consumerspublic int getMessageCount()
getMessageCount
in class AbstractDestinationCache
public boolean canDestroy()
QueueDestinationCache
can be destroyed if there are no active consumers and: canDestroy
in class AbstractDestinationCache
true
if the cache can be destroyed, otherwise
false
public void destroy()
destroy
in class AbstractDestinationCache
protected void init() throws javax.jms.JMSException
javax.jms.JMSException
- if the cache can't be initialisedprotected void addMessage(MessageRef reference, MessageImpl message, MessageHandle handle) throws javax.jms.JMSException
reference
- a reference to the messagemessage
- the messagehandle
- the handle to addjavax.jms.JMSException
- for any errorprotected void notifyQueueListeners(MessageHandle handle, MessageImpl message) throws javax.jms.JMSException
handle
- a handle to the messagemessage
- the messagejavax.jms.JMSException
- if a browser fails to handle the messageprotected void messageExpired(MessageRef reference) throws javax.jms.JMSException
messageExpired
in class AbstractDestinationCache
reference
- the reference to the expired messagejavax.jms.JMSException
- for any errorprotected void persistentMessageExpired(MessageRef reference) throws javax.jms.JMSException, PersistenceException
persistentMessageExpired
in class AbstractDestinationCache
reference
- the reference to the expired messagejavax.jms.JMSException
- if a listener fails to handle the
expirationPersistenceException
- if there is a persistence related problem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |