activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rolandpeng <>
Subject UndeclaredThrowableException while calling getQueue() and removeQueue() at the same time(by use RemoteJMXBrokerFacade)
Date Mon, 18 Jun 2012 03:51:15 GMT
I'm trying to use org.apache.activemq.web.RemoteJMXBrokerFacade to preform
deleteQueue and getQueue.

The senario:
I have 100 queues(naming queue1~queue100) in broker,and the queue owner is
user1~user100 for each queue responding to the queue name.

let's say a situation below,
When user1 call remoteJMXBrokerFacade.getBrokerAdmin().getQueue("queue1"),
user2 delete "queue2" in the meantime.

This exception occrred.
	at $Proxy57.getName(Unknown Source)

But this exception is not always happened. This exception only happens while
the  time between getQueue and deleteQueue called very close.
(I use activemq 5.5.1)

let me post the source code of BrokerFacadeSupport.getDestinationByName
    protected DestinationViewMBean getDestinationByName(Collection<? extends
DestinationViewMBean> collection,
            String name) {
        Iterator<? extends DestinationViewMBean> iter =
        while (iter.hasNext()) {
            DestinationViewMBean destinationViewMBean =;
            if (name.equals(destinationViewMBean.getName())) {
                return destinationViewMBean;
        return null;
I think the key point of this exception is

While user1 call getQueue for queue1, the destinationViewMBean for queue2 is
no longer existed casue of  "queue2" has been deleted by user2.

It's not reasonable that user2 delete queue2, but user1 call
getQueue("queue1") receives exception.

so I write my own getQueue(String queueName) method to preventing from this

			JMXServiceURL url = new JMXServiceURL(
			JMXConnector jmxc = JMXConnectorFactory.connect(url);
			MBeanServerConnection conn = jmxc.getMBeanServerConnection();

			ObjectName objectNameRequest = new ObjectName(
							+ queueName.replace("::", "__"));

			queueViewMbean = (QueueViewMBean) MBeanServerInvocationHandler
					.newProxyInstance(conn, objectNameRequest,
							QueueViewMBean.class, true);
Is it a bug in BrokerFacadeSupport.getDestinationByName()? Or I have another
way to get Queue via RemoteJMXBrokerFacade for recommendation? I prefer to
use JMX in activemq. Thank you.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message