// mbean is not yet registered.Adding the destination to activemq broker.
ObjectName brokerObj = createBrokerObjectName(brokerInfo.getBrokerName());
Set set = server.queryMBeans(brokerObj, null);
Iterator it = set.iterator();
if (it.hasNext()) {
ObjectInstance instance = (ObjectInstance) it.next();
brokerObj = instance.getObjectName();
}
BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObj, BrokerViewMBean.class, true);
brokerMBean.addQueue(destinationInfo.getPhysicalName());
}
proxy = (DestinationViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, objName, QueueViewMBean.class, true);
} else {
if (!server.isRegistered(objName)) {
// mbean is not yet registered.Adding the destination to activemq broker.
ObjectName brokerObj = createBrokerObjectName(brokerInfo.getBrokerName());
Set set = server.queryMBeans(brokerObj, null);
Iterator it = set.iterator();
if (it.hasNext()) {
ObjectInstance instance = (ObjectInstance) it.next();
brokerObj = instance.getObjectName();
}
BrokerViewMBean brokerMBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, brokerObj, BrokerViewMBean.class, true);
brokerMBean.addTopic(destinationInfo.getPhysicalName());
}
proxy = (DestinationViewMBean) MBeanServerInvocationHandler.newProxyInstance(server, objName, TopicViewMBean.class, true);