Index: src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java =================================================================== --- src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java (revision 10241) +++ src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java (revision ) @@ -725,30 +725,36 @@ Set sessions = server.getHornetQServer().getSessions(); - Map jmsSessions = new HashMap(); + Map jmsSessions = new HashMap(); for (ServerSession session : sessions) { if (session.getMetaData("jms-session") != null) { - jmsSessions.put(session.getConnectionID(), session); + JSONArray jmsSession = jmsSessions.get(session.getConnectionID()); + if(jmsSession == null) + { + jmsSession = new JSONArray(); + jmsSessions.put(session.getConnectionID(), jmsSession); - } + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name", session.getName()); + jsonObject.put("clientID", session.getMetaData("jms-client-id")); + jsonObject.put("principal", session.getUsername()); + jmsSession.put(jsonObject); - } + } + } for (RemotingConnection connection : connections) { - ServerSession session = jmsSessions.get(connection.getID()); - if (session != null) - { + JSONArray sessionInfo = jmsSessions.get(connection.getID()); - JSONObject obj = new JSONObject(); - obj.put("connectionID", connection.getID().toString()); - obj.put("clientAddress", connection.getRemoteAddress()); - obj.put("creationTime", connection.getCreationTime()); + 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()); + obj.put("sessions", sessionInfo != null?sessionInfo:new JSONArray()); - array.put(obj); - } + array.put(obj); + } - } return array.toString(); } finally