[jboss-cvs] JBoss Messaging SVN: r4074 - in trunk: src/main/org/jboss/messaging/core/remoting/impl/codec and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 17 11:33:42 EDT 2008


Author: jmesnil
Date: 2008-04-17 11:33:42 -0400 (Thu, 17 Apr 2008)
New Revision: 4074

Removed:
   trunk/src/main/org/jboss/messaging/core/client/impl/JMSClientVMIdentifier.java
Modified:
   trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/CreateConnectionMessageCodec.java
   trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateConnectionRequest.java
   trunk/src/main/org/jboss/messaging/core/server/ConnectionManager.java
   trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
   trunk/src/main/org/jboss/messaging/core/server/impl/ConnectionManagerImpl.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java
   trunk/src/main/org/jboss/messaging/core/server/impl/ServerConnectionImpl.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/wireformat/PacketTypeTest.java
Log:
* simplified ConnectionManager and removed client VM ID.

Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientConnectionFactoryImpl.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -33,7 +33,6 @@
 import org.jboss.messaging.core.remoting.impl.wireformat.CreateConnectionRequest;
 import org.jboss.messaging.core.remoting.impl.wireformat.CreateConnectionResponse;
 import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.core.version.impl.VersionImpl;
 import org.jboss.messaging.util.VersionLoader;
 
 
@@ -128,7 +127,7 @@
          long sessionID = remotingConnection.getSessionID();
          
          CreateConnectionRequest request =
-            new CreateConnectionRequest(clientVersion.getIncrementingVersion(), sessionID, JMSClientVMIdentifier.instance, username, password);
+            new CreateConnectionRequest(clientVersion.getIncrementingVersion(), sessionID, username, password);
          
          CreateConnectionResponse response =
             (CreateConnectionResponse)remotingConnection.send(0, request);

Deleted: trunk/src/main/org/jboss/messaging/core/client/impl/JMSClientVMIdentifier.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/JMSClientVMIdentifier.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/JMSClientVMIdentifier.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -1,38 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.messaging.core.client.impl;
-
-import java.util.UUID;
-
-/**
- * 
- * Unique id of a JMS client VM
- * 
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JMSClientVMIdentifier
-{
-   public static String instance = UUID.randomUUID().toString();
-}

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/CreateConnectionMessageCodec.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/CreateConnectionMessageCodec.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/codec/CreateConnectionMessageCodec.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -37,7 +37,6 @@
    {
       int bodyLength = INT_LENGTH // version
             + LONG_LENGTH +
-            + sizeof(packet.getClientVMID())
             + sizeof(packet.getUsername()) 
             + sizeof(packet.getPassword());
       return bodyLength;
@@ -49,13 +48,11 @@
    {
       int version = request.getVersion();
       long remotingSessionID = request.getRemotingSessionID();
-      String clientVMID = request.getClientVMID();
       String username = request.getUsername();
       String password = request.getPassword();
 
       out.putInt(version);
       out.putLong(remotingSessionID);
-      out.putNullableString(clientVMID);
       out.putNullableString(username);
       out.putNullableString(password);
    }
@@ -65,11 +62,10 @@
    {
       int version = in.getInt();
       long remotingSessionID = in.getLong();
-      String clientVMID = in.getNullableString();
       String username = in.getNullableString();
       String password = in.getNullableString();
 
-      return new CreateConnectionRequest(version, remotingSessionID, clientVMID, username, password);
+      return new CreateConnectionRequest(version, remotingSessionID, username, password);
    }
 
    // Package protected ---------------------------------------------

Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateConnectionRequest.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateConnectionRequest.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/wireformat/CreateConnectionRequest.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -23,7 +23,6 @@
 
    private final int version;
    private final long remotingSessionID;
-   private final String clientVMID;
    private final String username;
    private final String password;
 
@@ -32,13 +31,12 @@
    // Constructors --------------------------------------------------
 
    public CreateConnectionRequest(final int version,
-         final long remotingSessionID, final String clientVMID, final String username, final String password)
+         final long remotingSessionID, final String username, final String password)
    {
       super(CREATECONNECTION);
 
       this.version = version;
       this.remotingSessionID = remotingSessionID;
-      this.clientVMID = clientVMID;
       this.username = username;
       this.password = password;
    }
@@ -54,11 +52,6 @@
    {
       return remotingSessionID;
    }
-   
-   public String getClientVMID()
-   {
-      return clientVMID;
-   }
 
    public String getUsername()
    {
@@ -76,7 +69,6 @@
       StringBuffer buf = new StringBuffer(getParentString());
       buf.append(", version=" + version);
       buf.append(", remotingSessionID=" + remotingSessionID);
-      buf.append(", clientVMID=" + clientVMID);
       buf.append(", username=" + username);
       buf.append(", password=" + password);
       buf.append("]");

Modified: trunk/src/main/org/jboss/messaging/core/server/ConnectionManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/ConnectionManager.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/server/ConnectionManager.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -37,10 +37,9 @@
  *
  * $Id$
  */
-public interface ConnectionManager extends MessagingComponent
+public interface ConnectionManager
 {
-   void registerConnection(String clientVMID,
-                           long remotingClientSessionID, ServerConnection endpoint);
+   void registerConnection(long remotingClientSessionID, ServerConnection endpoint);
 
    /**
     * @param ServerConnection 

Modified: trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -88,8 +88,7 @@
    void setPostOffice(PostOffice postOffice);
    
    CreateConnectionResponse createConnection(String username, String password,
-                                             long remotingClientSessionID, String clientVMID,
-                                             String clientAddress,
+                                             long remotingClientSessionID, String clientAddress,
                                              int incrementVersion) throws Exception;
 
    DeploymentManager getDeploymentManager();

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ConnectionManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ConnectionManagerImpl.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ConnectionManagerImpl.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -23,14 +23,11 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
 
 import org.jboss.messaging.core.client.FailureListener;
-import org.jboss.messaging.core.client.impl.JMSClientVMIdentifier;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.RemotingException;
@@ -57,25 +54,17 @@
    // Attributes -----------------------------------------------------------------------------------
 
    private Map<Long /* remoting session ID */, List<ServerConnection>> endpoints;
-
-   private Set<ServerConnection> activeServerConnections;
-
-   // the clients maps is for information only: to better identify the clients of
-   // jboss messaging using their VM ID
-   private Map<Long /* remoting session id */, String /* client vm id */> clients;
    
    // Constructors ---------------------------------------------------------------------------------
 
    public ConnectionManagerImpl()
    {
       endpoints = new HashMap<Long, List<ServerConnection>>();
-      activeServerConnections = new HashSet<ServerConnection>();
-      clients = new HashMap<Long, String>();
    }
 
    // ConnectionManager implementation -------------------------------------------------------------
 
-   public synchronized void registerConnection(String clientVMID, long remotingClientSessionID,
+   public synchronized void registerConnection(long remotingClientSessionID,
          ServerConnection endpoint)
    {    
       List<ServerConnection> connectionEndpoints = endpoints.get(remotingClientSessionID);
@@ -88,10 +77,6 @@
 
       connectionEndpoints.add(endpoint);
 
-      activeServerConnections.add(endpoint);
-
-      clients.put(remotingClientSessionID, clientVMID);
-
       log.debug("registered connection " + endpoint + " as " + remotingClientSessionID);
    }
    
@@ -102,19 +87,13 @@
 
       if (connectionEndpoints != null)
       {
-         boolean removed = connectionEndpoints.remove(endpoint);
+         connectionEndpoints.remove(endpoint);
 
-         if (removed)
-         {
-            activeServerConnections.remove(endpoint);
-         }
-
          log.debug("unregistered connection " + endpoint + " with remoting session ID " + remotingClientSessionID);
 
          if (connectionEndpoints.isEmpty())
          {
             endpoints.remove(remotingClientSessionID);           
-            clients.remove(remotingClientSessionID);
          }
 
          return endpoint;
@@ -126,21 +105,12 @@
    {
       // I will make a copy to avoid ConcurrentModification
       List<ServerConnection> list = new ArrayList<ServerConnection>();
-      list.addAll(activeServerConnections);
+      for (List<ServerConnection> connections : endpoints.values())
+      {
+         list.addAll(connections);
+      }
       return list;
    }      
-      
-   // MessagingComponent implementation ------------------------------------------------------------
-   
-   public void start() throws Exception
-   {
-      //NOOP
-   }
-   
-   public void stop() throws Exception
-   {
-      //NOOP
-   }
 
    // FailureListener implementation --------------------------------------------------------------
    
@@ -149,6 +119,7 @@
       if (me instanceof RemotingException)
       {
          RemotingException re = (RemotingException) me;
+         log.warn(re.getMessage(), re);
          handleClientFailure(re.getSessionID(), true);
       }
    }
@@ -173,18 +144,11 @@
     */
    private synchronized void handleClientFailure(long remotingSessionID, boolean clientToServer)
    {
-      String clientVMID = clients.get(remotingSessionID);
-
-      if (clientVMID == null)
-      {
-         return;
-      }
-      
       log.warn("A problem has been detected " +
          (clientToServer ?
             "with the connection to remote client ":
             "trying to send a message to remote client ") +
-         remotingSessionID + ", client VM ID=" + clientVMID + ". It is possible the client has exited without closing " +
+         remotingSessionID + ". It is possible the client has exited without closing " +
          "its connection(s) or the network has failed. All connection resources " +
          "corresponding to that client process will now be removed.");
 
@@ -223,18 +187,6 @@
       if (log.isDebugEnabled())
       {
          StringBuffer buff = new StringBuffer("*********** Dumping connections\n");
-         buff.append("this client VM ID: ").append(JMSClientVMIdentifier.instance).append("\n");
-         buff.append("remoting session ID <----> client VM ID:\n");
-         if (clients.size() == 0)
-         {
-            buff.append("    No registered sessions\n");
-         }
-         for (Entry<Long, String> client : clients.entrySet())
-         {
-            long remotingSessionID = client.getKey();
-            String clientVMID = client.getValue();
-            buff.append("    ").append(remotingSessionID).append(" <----> ").append(clientVMID).append("\n");
-         }
          buff.append("remoting session ID -----> server connection endpoints:\n");
          if (endpoints.size() == 0)
          {

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -60,7 +60,6 @@
 import org.jboss.messaging.core.transaction.ResourceManager;
 import org.jboss.messaging.core.transaction.impl.ResourceManagerImpl;
 import org.jboss.messaging.core.version.Version;
-import org.jboss.messaging.core.version.impl.VersionImpl;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.util.VersionLoader;
 
@@ -181,7 +180,6 @@
       }
       // Start the wired components
       securityDeployer.start();
-      connectionManager.start();
       remotingService.addFailureListener(connectionManager);
       memoryManager.start();
       postOffice.start();
@@ -224,7 +222,6 @@
       securityDeployer.stop();
       queueSettingsDeployer.stop();
       deploymentManager.stop();
-      connectionManager.stop();
       remotingService.removeFailureListener(connectionManager);
       connectionManager = null;
       memoryManager.stop();
@@ -333,8 +330,7 @@
    }
 
    public CreateConnectionResponse createConnection(final String username, final String password,
-                                                    final long remotingClientSessionID, final String clientVMID,
-                                                    final String clientAddress,
+                                                    final long remotingClientSessionID, final String clientAddress,
                                                     final int incrementVersion)
       throws Exception
    {
@@ -354,7 +350,7 @@
 
       final ServerConnection connection =
          new ServerConnectionImpl(username, password,
-                          remotingClientSessionID, clientVMID, clientAddress,
+                          remotingClientSessionID, clientAddress,
                           remotingService.getDispatcher(), resourceManager, storageManager,
                           queueSettingsRepository,
                           postOffice, securityStore, connectionManager,

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -75,7 +75,6 @@
          
          response = server.createConnection(request.getUsername(), request.getPassword(),
          		                             request.getRemotingSessionID(),
-                                            request.getClientVMID(),
                                             sender.getRemoteAddress(),
                                             request.getVersion());
       }     

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerConnectionImpl.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerConnectionImpl.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -106,7 +106,7 @@
    // Constructors ---------------------------------------------------------------------------------
       
    public ServerConnectionImpl(final String username, final String password,
-   		                      final long remotingClientSessionID, final String jmsClientVMID,
+   		                      final long remotingClientSessionID,
    		                      final String clientAddress,
    		                      final PacketDispatcher dispatcher,
    		                      final ResourceManager resourceManager,
@@ -146,7 +146,7 @@
       
       createdTime = System.currentTimeMillis();
 
-      connectionManager.registerConnection(jmsClientVMID, remotingClientSessionID, this);
+      connectionManager.registerConnection(remotingClientSessionID, this);
    }
 
    // ServerConnection implementation ------------------------------------------------------------

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/wireformat/PacketTypeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/wireformat/PacketTypeTest.java	2008-04-17 15:14:31 UTC (rev 4073)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/wireformat/PacketTypeTest.java	2008-04-17 15:33:42 UTC (rev 4074)
@@ -445,15 +445,14 @@
    {
       int version = randomInt();
       long remotingSessionID = randomLong();
-      String clientVMID = randomString();
       String username = null;
       String password = null;
       CreateConnectionRequest request = new CreateConnectionRequest(version,
-            remotingSessionID, clientVMID, username, password);
+            remotingSessionID, username, password);
       AbstractPacketCodec<CreateConnectionRequest> codec = new CreateConnectionMessageCodec();
 
       Packet decodedPacket = encodeAndCheckBytesAndDecode(request, codec,
-            version, remotingSessionID, clientVMID, username, password);
+            version, remotingSessionID, username, password);
 
       assertTrue(decodedPacket instanceof CreateConnectionRequest);
       CreateConnectionRequest decodedRequest = (CreateConnectionRequest) decodedPacket;
@@ -462,7 +461,6 @@
       assertEquals(request.getVersion(), decodedRequest.getVersion());
       assertEquals(request.getRemotingSessionID(), decodedRequest
             .getRemotingSessionID());
-      assertEquals(request.getClientVMID(), decodedRequest.getClientVMID());
       assertEquals(request.getUsername(), decodedRequest.getUsername());
       assertEquals(request.getPassword(), decodedRequest.getPassword());
    }




More information about the jboss-cvs-commits mailing list