[hornetq-commits] JBoss hornetq SVN: r11663 - in trunk: tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 4 10:38:08 EDT 2011


Author: borges
Date: 2011-11-04 10:38:08 -0400 (Fri, 04 Nov 2011)
New Revision: 11663

Modified:
   trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
   trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
HORNETQ-720 Close the replicating backup if failed to connect to live.
Disable test (if sharedStore==false) that tried to
(1) stop the backup,
(2) crash the live,
(3) restart the backup.

Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java	2011-11-04 10:34:47 UTC (rev 11662)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java	2011-11-04 14:38:08 UTC (rev 11663)
@@ -2021,6 +2021,7 @@
    private final class SharedNothingBackupActivation implements Activation
    {
       private ServerLocatorInternal serverLocator;
+      private volatile boolean failedConnection;
 
       public void run()
       {
@@ -2068,7 +2069,21 @@
                   }
                   catch (Exception e)
                   {
-                     log.warn("Unable to announce backup for replication.", e);
+                     log.warn("Unable to announce backup for replication. Trying to stop the server.", e);
+                     failedConnection = true;
+                     try
+                     {
+                        synchronized (quorumManager)
+                        {
+                           quorumManager.notify();
+                        }
+                        HornetQServerImpl.this.stop();
+                        return;
+                     }
+                     catch (Exception e1)
+                     {
+                        throw new RuntimeException(e1);
+                     }
                   }
                }
             });
@@ -2081,11 +2096,12 @@
             // we must remember to close stuff we don't need any more
             synchronized (quorumManager)
             {
-            while (true)
-            {
+               if (failedConnection)
+                  return;
+               while (true)
+               {
                   quorumManager.wait();
-                  // nodeManager.awaitLiveNode();
-               break;
+                  break;
 //               if (!started || quorumManager.isNodeDown())
 //               {
 //                  break;
@@ -2096,6 +2112,8 @@
             serverLocator.close();
             replicationEndpoint.stop();
 
+            if (failedConnection)
+               return;
             if (!isRemoteBackupUpToDate())
             {
                /*

Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java	2011-11-04 10:34:47 UTC (rev 11662)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java	2011-11-04 14:38:08 UTC (rev 11663)
@@ -1580,6 +1580,9 @@
 
    public void testBackupServerNotRemoved() throws Exception
    {
+      // HORNETQ-720 Disabling test for replicating backups.
+      if (!backupServer.getServer().getConfiguration().isSharedStore())
+         return;
       locator.setFailoverOnInitialConnection(true);
       createSessionFactory();
 



More information about the hornetq-commits mailing list