|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
jrunx.kernel.ServiceAdapter
|
+--jrunx.kernel.ServicePartition
|
+--jrun.jms.core.util.JMSServicePartition
|
+--jrun.jms.core.messagemgr.MessageManagerService
| Field Summary | |
static java.lang.String |
OBJECT_NAME
|
| Fields inherited from class jrunx.kernel.ServicePartition |
sortedServices |
| Fields inherited from class jrunx.kernel.ServiceAdapter |
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER |
| Fields inherited from interface jrunx.kernel.Service |
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED |
| Constructor Summary | |
MessageManagerService()
|
|
| Method Summary | |
void |
add(MessageImpl message)
Add a message to the message manager for the specified destination. |
void |
addDestination(JmsDestination destination)
Create the specified Destination. |
void |
addEventListener(JmsDestination destination,
MessageManagerEventListener listener)
Add a message listener for a specific destination to be informed when messages, for the destination are added or removed from the queue. |
protected void |
addNonPersistentMessage(MessageImpl message)
This method is used to process non-persistent messages. |
protected void |
addPersistentMessage(MessageImpl message)
This method is used to process persistent messages. |
void |
collectGarbage()
Perform any garbage collection on this resource. |
void |
execute(java.lang.Object object)
This is called to complete the processing of incoming messages. |
boolean |
exists(JmsDestination destination)
Return true if the specified destination exists. |
java.util.Iterator |
getConsumers(JmsDestination destination)
Returns an iterator of active consumers registered to a given destination |
java.util.Iterator |
getDestinations()
Returns a list of active destinations |
int |
getGarbageCollectionEvent()
Returns garbage collection event type |
int |
getMaximumSize()
Return the maximum size of the cache |
javax.jms.Message |
getMessage(MessageHandle handle)
Resolve the message for the specified handle. |
int |
getOutstanding(JmsDestination destination)
Returns the number of outstanding messages for this destination. |
boolean |
hasMessages(ConsumerEndpoint consumer)
Returns true if there are any messages for the specified consumer |
void |
init()
This method may only be invoked once. |
static MessageManagerService |
instance()
|
void |
removeDestination(JmsDestination destination)
Remove this destination and all attached consumers. |
void |
removeEventListener(JmsDestination destination,
MessageManagerEventListener listener)
Remove the listener for the specified destination. |
javax.jms.Message |
removeMessage(MessageId id)
Remove the specified message from the system. |
JmsDestination |
resolve(java.lang.String name)
Resolves a destination given its name |
ConsumerEndpoint |
resolveConsumer(JmsDestination destination,
java.lang.String id)
Resolves a consumer given its destination and an identity. |
void |
run()
Run the MessageMgr. |
void |
setStopped(ConsumerEndpoint consumer,
boolean stop)
Stop/start a consumer. |
void |
start()
Start the MessageMgr. |
void |
stop()
Stop the MessageMgr. |
boolean |
validateDestination(JmsDestination dest)
|
| Methods inherited from class jrun.jms.core.util.JMSServicePartition |
restart, resume, suspend |
| Methods inherited from class jrunx.kernel.ServicePartition |
addService, addService, getServices, invokeChain, iterator, removeService, removeService |
| Methods inherited from interface jrunx.kernel.ServicePartitionMBean |
addService, addService, iterator, removeService, removeService |
| Methods inherited from interface jrunx.kernel.ServiceMBean |
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind |
| Methods inherited from interface jrunx.kernel.Service |
destroy, getStatus, updateStatus |
| Field Detail |
public static final java.lang.String OBJECT_NAME
| Constructor Detail |
public MessageManagerService()
| Method Detail |
public static MessageManagerService instance()
public void init()
throws java.lang.Exception
This method may only be invoked once. Subsequent calls will throw a
JMSException, unless the MessageMgr is stopped via stop().
init in interface Serviceinit in class ServiceAdapterJMSException - if initialisation fails or the
instance is already initialised
public void addDestination(JmsDestination destination)
throws javax.jms.JMSException
Destination. The destination is a container
for messages and consumers. Consumers listen for messages posted on a
particular desitnation.
This can be called multiple times without any side effects. If the destination is null then it throws a JMSException
addDestination in interface MessageManagerdestination - - create this destinationJMSException - - if the params is null
public void removeDestination(JmsDestination destination)
throws javax.jms.JMSException
removeDestination in interface MessageManagerdestination - - the destination to removeJMSException - public boolean exists(JmsDestination destination)
exists in interface MessageManagerdestination - - destination to check
public void add(MessageImpl message)
throws javax.jms.JMSException
If the destination, specified in the message, dos not exist then create it. destinations
add in interface MessageManagermessage - the message to addJMSException - if the message cannot be added
protected void addNonPersistentMessage(MessageImpl message)
throws javax.jms.JMSException
message - - the message to processJMSException - - if the message cannot be processed
protected void addPersistentMessage(MessageImpl message)
throws javax.jms.JMSException
message - - the message to processJMSException - - if the message cannot be processedpublic void execute(java.lang.Object object)
processed flag is set to for the message.execute in interface QueueWorkerobject - - the message to process
public int getOutstanding(JmsDestination destination)
throws javax.jms.JMSException
JMSException
exception will be raised.getOutstanding in interface MessageManagerdestination - - the destination to queryJMSException - - if destination is null or of type JMSQueue
public boolean hasMessages(ConsumerEndpoint consumer)
throws javax.jms.JMSException
hasMessages in interface MessageManagerconsumer - - the consumer to checkJMSException - - if the consumer can't be checkedpublic boolean validateDestination(JmsDestination dest)
public java.util.Iterator getDestinations()
getDestinations in interface MessageManager
public java.util.Iterator getConsumers(JmsDestination destination)
throws javax.jms.JMSException
getConsumers in interface MessageManagerConsumer objects.JMSException - public JmsDestination resolve(java.lang.String name)
resolve in interface MessageManagername - the name of the destination
public ConsumerEndpoint resolveConsumer(JmsDestination destination,
java.lang.String id)
resolveConsumer in interface MessageManagerdestination - the destinationname - the name of the consumerpublic void run()
public void start()
throws java.lang.Exception
This invokes run
start in interface Servicestart in class ServiceAdapterJMSException - if stop fails
public void stop()
throws java.lang.Exception
This stops the scheduler, stops and removes all dispatchers, and clears the singleton instance.
stop in interface Servicestop in class ServiceAdapterJMSException - if stop fails
public void setStopped(ConsumerEndpoint consumer,
boolean stop)
throws javax.jms.JMSException
consumer - the consumer to stop/startstop - when true stop the consumer
else start it.public javax.jms.Message getMessage(MessageHandle handle)
PersistentMessageHandle then we need to also attempt to
resolve it from the persistent store.getMessage in interface MessageManagerid - - message identitypublic javax.jms.Message removeMessage(MessageId id)
removeMessage in interface MessageManagerid - - identity of the message
public void addEventListener(JmsDestination destination,
MessageManagerEventListener listener)
If a listener is already registered for a particuler destination then it fails silently.
addEventListener in interface MessageManagerdestination - - what messgaes to listen forlistener - - a JmsMessageListener instance
public void removeEventListener(JmsDestination destination,
MessageManagerEventListener listener)
removeEventListener in interface MessageManagerdestination - - destination that it listens forlistener - - listener for that destination.public int getMaximumSize()
public int getGarbageCollectionEvent()
GarbageCollectablegetGarbageCollectionEvent in interface GarbageCollectablepublic void collectGarbage()
GarbageCollectablecollectGarbage in interface GarbageCollectable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||