* or all services if the passed service is null.
*/
public static List getConnectionInfoList(String service) {
ConnectionManager cm = Globals.getConnectionManager();
List connections, connectionInfoList = new ArrayList();
IMQConnection cxn;
ConnectionInfo cxnInfo;
try {
Service s = null;
if (service != null) {
s = Globals.getServiceManager().getService(service);
/*
* If service object is null, service may not exist or is inactive
*/
if (s == null) {
return (connectionInfoList);
}
}
connections = cm.getConnectionList(s);
} catch(Exception e) {
BrokerResources rb = Globals.getBrokerResources();
Logger logger = Globals.getLogger();
logger.log(Logger.WARNING,
rb.getString(rb.W_JMX_FAILED_TO_OBTAIN_CONNECTION_LIST),
e);
return (connectionInfoList);
}
if (connections.size() == 0) {
return (connectionInfoList);
}
Iterator iter = connections.iterator();
while (iter.hasNext()) {
cxn = (IMQConnection)iter.next();
cxnInfo = cxn.getConnectionInfo();
connectionInfoList.add(cxnInfo);
}
return (connectionInfoList);