Author: gaohoward
Date: 2010-10-15 08:34:13 -0400 (Fri, 15 Oct 2010)
New Revision: 9791
Removed:
branches/hornetq-416/src/main/org/hornetq/core/protocol/core/impl/wireformat/ConnectionSetClientIDMessage.java
Modified:
branches/hornetq-416/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
Log:
added principal
Deleted:
branches/hornetq-416/src/main/org/hornetq/core/protocol/core/impl/wireformat/ConnectionSetClientIDMessage.java
===================================================================
---
branches/hornetq-416/src/main/org/hornetq/core/protocol/core/impl/wireformat/ConnectionSetClientIDMessage.java 2010-10-15
11:38:17 UTC (rev 9790)
+++
branches/hornetq-416/src/main/org/hornetq/core/protocol/core/impl/wireformat/ConnectionSetClientIDMessage.java 2010-10-15
12:34:13 UTC (rev 9791)
@@ -1,56 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ConnectionSetClientIDMessage
- *
- *
- */
-public class ConnectionSetClientIDMessage extends PacketImpl
-{
- private String clientID;
-
- public ConnectionSetClientIDMessage()
- {
- super(PacketImpl.CONNECTION_SET_CLIENTID);
- }
-
- public ConnectionSetClientIDMessage(String cID)
- {
- super(PacketImpl.CONNECTION_SET_CLIENTID);
- clientID = cID;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeString(clientID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- clientID = buffer.readString();
- }
-
- public String getClientID()
- {
- return clientID;
- }
-
-}
Modified:
branches/hornetq-416/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
---
branches/hornetq-416/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-10-15
11:38:17 UTC (rev 9790)
+++
branches/hornetq-416/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-10-15
12:34:13 UTC (rev 9791)
@@ -739,20 +739,25 @@
Set<RemotingConnection> connections =
server.getHornetQServer().getRemotingService().getConnections();
Set<ServerSession> sessions = server.getHornetQServer().getSessions();
- Map<Object, String> clientIDs = new HashMap<Object, String>();
+
+ Map<Object, ServerSession> initialSessions = new HashMap<Object,
ServerSession>();
+
for (ServerSession session : sessions)
{
- if (session.getMetaData("jms-initial-session") != null) {
- clientIDs.put(session.getConnectionID(),
session.getMetaData("jms-client-id"));
+ if (session.getMetaData("jms-initial-session") != null)
+ {
+ initialSessions.put(session.getConnectionID(), session);
}
}
+
for (RemotingConnection connection : connections)
{
JSONObject obj = new JSONObject();
obj.put("connectionID", connection.getID().toString());
obj.put("clientAddress", connection.getRemoteAddress());
obj.put("creationTime", connection.getCreationTime());
- obj.put("clientID", clientIDs.get(connection.getID()));
+ obj.put("clientID",
initialSessions.get(connection.getID()).getMetaData("jms-client-id"));
+ obj.put("principal",
initialSessions.get(connection.getID()).getUsername());
array.put(obj);
}
return array.toString();