|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.jms.service.Service | +--org.exolab.jms.messagemgr.DestinationManagerImpl
The destination manager is responsible for creating and managing the
lifecycle of DestinationCache
objects. The destination manager is
also responsible for managing messages, that are received by the message
manager, which do not have any registered DestinationCache
.
Constructor Summary | |
DestinationManagerImpl(MessageManager messages,
DestinationCacheFactory factory,
DatabaseService database,
GarbageCollectionService collector)
Construct a new DestinationManagerImpl . |
Method Summary | |
void |
addDestinationEventListener(DestinationEventListener listener)
Register an event listener to be notified when destinations are created and destroyed. |
void |
collectGarbage(boolean aggressive)
Perform any garbage collection on this resource. |
void |
createDestination(JmsDestination destination)
Create a destination. |
protected void |
destroyDestinationCache(DestinationCache cache)
Delete the specfied destination. |
protected void |
destroyDestinationCache(JmsDestination dest)
Delete the specfied destination. |
protected void |
doStart()
Start the service. |
protected void |
doStop()
Stop the service. |
protected boolean |
exists(java.lang.String name)
Determines if a destination exists. |
JmsDestination |
getDestination(java.lang.String name)
Returns a destination given its name. |
DestinationCache |
getDestinationCache(JmsDestination destination)
Returns the cache for the supplied destination. |
java.util.List |
getDestinations()
Returns all destinations. |
java.util.Map |
getTopicDestinationCaches(JmsTopic topic)
Returns a map of all destinations that match the specified topic. |
protected void |
init()
Initialises the destination manager. |
void |
messageAdded(JmsDestination destination,
MessageImpl message)
Invoked when the MessageManager receives a non-persistent
message. |
void |
persistentMessageAdded(JmsDestination destination,
MessageImpl message)
Invoked when the MessageManager receives a persistent message. |
void |
removeDestination(JmsDestination destination)
Remove a destination. |
void |
removeDestinationEventListener(DestinationEventListener listener)
Remove an event listener. |
void |
setConsumerManager(ConsumerManager consumers)
Sets the consumer manager. |
Methods inherited from class org.exolab.jms.service.Service |
getName, isStarted, restart, start, stop, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DestinationManagerImpl(MessageManager messages, DestinationCacheFactory factory, DatabaseService database, GarbageCollectionService collector)
DestinationManagerImpl
.messages
- the message managerfactory
- the destination cache factorydatabase
- the database servicecollector
- the garbage collection serviceMethod Detail |
public void setConsumerManager(ConsumerManager consumers)
consumers
- the consumer managerpublic DestinationCache getDestinationCache(JmsDestination destination) throws javax.jms.JMSException
DestinationEventListener
s will be notified.getDestinationCache
in interface DestinationManager
destination
- the destination of the cache to returndestination
javax.jms.InvalidDestinationException
- if destination
doesn't
existjavax.jms.JMSException
- if the cache can't be createdpublic JmsDestination getDestination(java.lang.String name)
getDestination
in interface DestinationManager
name
- the name of the destinationname
or
null
if none existspublic void addDestinationEventListener(DestinationEventListener listener)
addDestinationEventListener
in interface DestinationManager
listener
- the listener to addpublic void removeDestinationEventListener(DestinationEventListener listener)
removeDestinationEventListener
in interface DestinationManager
listener
- the listener to removepublic void createDestination(JmsDestination destination) throws javax.jms.JMSException
DestinationEventListener
s will be notified.createDestination
in interface DestinationManager
destination
- the destination to createjavax.jms.InvalidDestinationException
- if the destination already exists or
is a wildcard destinationjavax.jms.JMSException
- if the destination can't be createdpublic void removeDestination(JmsDestination destination) throws javax.jms.JMSException
DestinationEventListener
s will be notified.removeDestination
in interface DestinationManager
destination
- the destination to removejavax.jms.InvalidDestinationException
- if the destination is invalidjavax.jms.JMSException
- if the destination can't be removedpublic void messageAdded(JmsDestination destination, MessageImpl message) throws javax.jms.JMSException
MessageManager
receives a non-persistent
message.messageAdded
in interface MessageManagerEventListener
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
MessageManager
receives a persistent message.persistentMessageAdded
in interface MessageManagerEventListener
destination
- the message's destinationmessage
- the messagejavax.jms.JMSException
- if the listener fails to handle the messagePersistenceException
- if there is a persistence related problempublic java.util.List getDestinations() throws javax.jms.JMSException
getDestinations
in interface DestinationManager
javax.jms.JMSException
- for any JMS errorpublic java.util.Map getTopicDestinationCaches(JmsTopic topic)
getTopicDestinationCaches
in interface DestinationManager
topic
- the topicpublic void collectGarbage(boolean aggressive)
collectGarbage
in interface GarbageCollectable
aggressive
- true
for aggressive garbage collectionprotected void doStart() throws ServiceException
doStart
in class Service
ServiceException
- if the service fails to startprotected void doStop() throws ServiceException
doStop
in class Service
ServiceException
- if the service fails to stopprotected void init() throws ServiceException
ServiceException
- if the service cannot be initialisedprotected boolean exists(java.lang.String name)
name
- the destination nametrue
if the destination exists, otherwise
false
protected void destroyDestinationCache(DestinationCache cache)
cache
- the destination to destroyprotected void destroyDestinationCache(JmsDestination dest)
dest
- the destination to destroy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |