[hornetq-commits] JBoss hornetq SVN: r11044 - in branches/Branch_2_2_EAP_cluster_clean2: src/main/org/hornetq/core/postoffice/impl and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jul 25 19:04:41 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-07-25 19:04:40 -0400 (Mon, 25 Jul 2011)
New Revision: 11044

Modified:
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
   branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
   branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
Log:
just adding debug

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -1131,66 +1131,69 @@
                }
             }
             // if connection fails we can try the backup in case it has come live
-            if (connector == null && backupConfig != null)
+            if (connector == null)
             {
-               if (isDebug)
+               if (backupConfig != null)
                {
-                  log.debug("Trying backup config = " + backupConfig);
-               }
-               ConnectorFactory backupConnectorFactory = instantiateConnectorFactory(backupConfig.getFactoryClassName());
-               connector = backupConnectorFactory.createConnector(backupConfig.getParams(),
-                                                                  handler,
-                                                                  this,
-                                                                  closeExecutor,
-                                                                  threadPool,
-                                                                  scheduledThreadPool);
-               if (connector != null)
-               {
-                  connector.start();
-
-                  tc = connector.createConnection();
-
-                  if (tc == null)
+                  if (isDebug)
                   {
-                     if (isDebug)
+                     log.debug("Trying backup config = " + backupConfig);
+                  }
+                  ConnectorFactory backupConnectorFactory = instantiateConnectorFactory(backupConfig.getFactoryClassName());
+                  connector = backupConnectorFactory.createConnector(backupConfig.getParams(),
+                                                                     handler,
+                                                                     this,
+                                                                     closeExecutor,
+                                                                     threadPool,
+                                                                     scheduledThreadPool);
+                  if (connector != null)
+                  {
+                     connector.start();
+   
+                     tc = connector.createConnection();
+   
+                     if (tc == null)
                      {
-                        log.debug("Backup is not active yet");
+                        if (isDebug)
+                        {
+                           log.debug("Backup is not active yet");
+                        }
+   
+                        try
+                        {
+                           connector.close();
+                        }
+                        catch (Throwable t)
+                        {
+                        }
+   
+                        connector = null;
                      }
-
-                     try
+                     else
                      {
-                        connector.close();
+                        /*looks like the backup is now live, lets use that*/
+   
+                        if (isDebug)
+                        {
+                           log.debug("Connected to the backup at " + backupConfig);
+                        }
+   
+                        connectorConfig = backupConfig;
+   
+                        backupConfig = null;
+   
+                        connectorFactory = backupConnectorFactory;
                      }
-                     catch (Throwable t)
-                     {
-                     }
-
-                     connector = null;
                   }
-                  else
+               }
+               else
+               {
+                  if (isTrace)
                   {
-                     /*looks like the backup is now live, lets use that*/
-
-                     if (isDebug)
-                     {
-                        log.debug("Connected to the backup at " + backupConfig);
-                     }
-
-                     connectorConfig = backupConfig;
-
-                     backupConfig = null;
-
-                     connectorFactory = backupConnectorFactory;
+                     log.trace("No Backup configured!", new Exception("trace"));
                   }
                }
             }
-            else
-            {
-               if (isTrace)
-               {
-                  log.trace("No Backup configured!", new Exception("trace"));
-               }
-            }
          }
          catch (Exception e)
          {
@@ -1288,6 +1291,11 @@
             }
          }
       }
+      
+      if (log.isDebugEnabled())
+      {
+         log.debug("returning " + connection);
+      }
 
       return connection;
    }

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -1400,6 +1400,11 @@
                            }
                         }
                      });
+                     
+                     if (log.isDebugEnabled())
+                     {
+                        log.debug("XXX Returning " + csf + " after " + retryNumber + " retries on StaticConnector " + ServerLocatorImpl.this);
+                     }
 
                      return csf;
                   }
@@ -1419,13 +1424,16 @@
          }
          catch (Exception e)
          {
+            log.warn("XXX " + e.getMessage(), e);
             throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to connect to any static connectors", e);
          }
 
          if (csf == null && !closed)
          {
+            log.warn("XXX Failed to connecto to any static connector, throwing exception now");
             throw new HornetQException(HornetQException.NOT_CONNECTED, "Failed to connect to any static connectors");
          }
+         log.warn("Returning " + csf + " on " + ServerLocatorImpl.this);
          return csf;
       }
 

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -473,7 +473,8 @@
       
       if (isTrace)
       {
-         log.trace("Seding notification for addBinding " + binding + " from server " + server);
+         //log.trace("Sending notification for addBinding " + binding + " from server " + server);
+         log.trace("XXX Sending notification for addBinding " + binding + " from server " + server, new Exception("trace"));
       }
 
       managementService.sendNotification(new Notification(uid, NotificationType.BINDING_ADDED, props));

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -48,6 +48,8 @@
    // ------------------------------------------------------------------------------------
 
    private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+   
+   private static final boolean isTrace = log.isTraceEnabled();
 
    // Static
    // ---------------------------------------------------------------------------------------
@@ -439,6 +441,11 @@
       try
       {
          final Packet packet = decoder.decode(buffer);
+         
+         if (isTrace)
+         {
+            log.trace("handling packet " + packet);
+         }
             
          if (packet.isAsyncExec() && executor != null)
          {

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -404,7 +404,7 @@
 
 	  if (isTrace)
 	  {
-	     log.trace("Connection removed " + connectionID, new Exception ("trace"));
+	     log.trace("Connection removed " + connectionID + " from server " + this.server, new Exception ("trace"));
 	  }
       
       ConnectionEntry conn = connections.get(connectionID);

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -321,7 +321,7 @@
          serverLocator.removeClusterTopologyListener(this);
       }
       
-      log.debug("Cluster connection being stopped for node" + nodeUUID);
+      log.debug("Cluster connection being stopped for node" + nodeUUID + ", server = " + this.server + " serverLocator = " + serverLocator );
 
       synchronized (this)
       {

Modified: branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -788,7 +788,13 @@
          {
             ClusterManagerImpl.log.warn("No discovery group with name '" + config.getDiscoveryGroupName() +
                                         "'. The cluster connection will not be deployed.");
+            return;
          }
+         
+         if (log.isDebugEnabled())
+         {
+            log.debug("XXX " + this + " Starting a Discovery Group Cluster Connection, name=" + config.getDiscoveryGroupName() + ", dg=" + dg);
+         }
 
          clusterConnection = new ClusterConnectionImpl(dg,
                                                        connector,
@@ -819,6 +825,11 @@
       {
          TransportConfiguration[] tcConfigs = config.getStaticConnectors() != null ? connectorNameListToArray(config.getStaticConnectors())
                                                                                   : null;
+         
+         if (log.isDebugEnabled())
+         {
+            log.debug("XXX " + this + " defining cluster connection towards " + tcConfigs);
+         }
 
          clusterConnection = new ClusterConnectionImpl(tcConfigs,
                                                        connector,
@@ -850,6 +861,10 @@
 
       clusterConnections.put(config.getName(), clusterConnection);
 
+      if (log.isDebugEnabled())
+      {
+         log.debug("XXX ClusterConnection.start at " + clusterConnection, new Exception ("trace"));
+      }
       clusterConnection.start();
 
       if (backup)

Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -117,6 +117,7 @@
    @Override
    protected void tearDown() throws Exception
    {
+      log.info("#test tearDown");
       for (ServerLocator locator : locators)
       {
          try

Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java	2011-07-25 15:10:19 UTC (rev 11043)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java	2011-07-25 23:04:40 UTC (rev 11044)
@@ -52,6 +52,7 @@
    @Override
    protected void tearDown() throws Exception
    {
+      log.info("#test tearDown");
       closeAllConsumers();
 
       closeAllSessionFactories();
@@ -126,6 +127,17 @@
 
       stopServers(0, 1);
    }
+   
+   public void testLoop() throws Exception
+   {
+      for (int i = 0 ; i < 100; i++)
+      {
+         log.info("#test " + i);
+         testStopStart();
+         tearDown();
+         setUp();
+      }
+   }
 
    public void testStopStart() throws Exception
    {
@@ -157,15 +169,17 @@
       log.info("*********** Stopping server 1");
       stopServers(1);
       log.info("*********** Stopped server 1");
-      
-      Thread.sleep(1000);
 
       System.out.println(clusterDescription(servers[0]));
+      
+      Thread.sleep(5000);
 
+      log.info ("********* Starting server 1");
       startServers(1);
 
-      System.out.println(clusterDescription(servers[0]));
-      System.out.println(clusterDescription(servers[1]));
+      log.info ("********* Describing servers");
+      log.info(servers[0].describe());
+      log.info(servers[1].describe());
 
       setupSessionFactory(1, isNetty());
 



More information about the hornetq-commits mailing list