jmxConnectServer();
ArrayList<Exchange> result = new ArrayList<Exchange>();
ObjectName objname = new ObjectName("com.sun.messaging.jms.server:type=Destination,subtype=Monitor,desttype=q,name=*");
for(ObjectName n : connection.queryNames(objname, null)) {
Exchange excQ = new Exchange(connection.getAttribute(n, "Name").toString());
excQ.setQueue();
result.add(excQ);
}
objname = new ObjectName("com.sun.messaging.jms.server:type=Destination,subtype=Monitor,desttype=t,name=*");
for(ObjectName n : connection.queryNames(objname, null)) {
Exchange excT = new Exchange(connection.getAttribute(n, "Name").toString());
excT.setTopic();
result.add(excT);
}
Exchange excAdmin = new Exchange("mq.sys.dmq");
excAdmin.setQueue();
result.remove(excAdmin);
return result;
}
catch(Exception e) {
throw new Exception(e.getMessage());