clearIO();
try
{
JSONArray array = new JSONArray();
Set<RemotingConnection> connections = server.getHornetQServer().getRemotingService().getConnections();
Set<ServerSession> sessions = server.getHornetQServer().getSessions();
Map<Object, ServerSession> jmsSessions = new HashMap<Object, ServerSession>();
for (ServerSession session : sessions)
{
if (session.getMetaData("jms-session") != null)
{
jmsSessions.put(session.getConnectionID(), session);
}
}
for (RemotingConnection connection : connections)
{
ServerSession session = jmsSessions.get(connection.getID());
if (session != null)
{
JSONObject obj = new JSONObject();
obj.put("connectionID", connection.getID().toString());
obj.put("clientAddress", connection.getRemoteAddress());
obj.put("creationTime", connection.getCreationTime());
obj.put("clientID", session.getMetaData("jms-client-id"));
obj.put("principal", session.getUsername());
array.put(obj);
}
}
return array.toString();
}
finally
{
blockOnIO();
}