[hornetq-commits] JBoss hornetq SVN: r11251 - branches/Branch_2_2_EAP_cluster_clean3/src/main/org/hornetq/core/server/cluster/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Aug 30 21:29:56 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-08-30 21:29:55 -0400 (Tue, 30 Aug 2011)
New Revision: 11251

Modified:
   branches/Branch_2_2_EAP_cluster_clean3/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
Log:
fixing ClusterConnectionControlTest

Modified: branches/Branch_2_2_EAP_cluster_clean3/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean3/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-08-30 23:22:32 UTC (rev 11250)
+++ branches/Branch_2_2_EAP_cluster_clean3/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-08-31 01:29:55 UTC (rev 11251)
@@ -57,6 +57,7 @@
 import org.hornetq.core.server.management.ManagementService;
 import org.hornetq.core.server.management.Notification;
 import org.hornetq.utils.ExecutorFactory;
+import org.hornetq.utils.Future;
 import org.hornetq.utils.TypedProperties;
 import org.hornetq.utils.UUID;
 
@@ -333,20 +334,26 @@
       this.clusterManagerTopology = clusterManagerTopology;
    }
 
-   public synchronized void start() throws Exception
+   public void start() throws Exception
    {
-      if (started)
+      flushExecutor();
+      
+      synchronized (this)
       {
-         return;
+         if (started)
+         {
+            return;
+         }
+         
+   
+         started = true;
+   
+         if (!backup)
+         {
+            activate();
+         }
       }
 
-      started = true;
-
-      if (!backup)
-      {
-         activate();
-      }
-
    }
 
    public void stop() throws Exception
@@ -355,6 +362,8 @@
       {
          return;
       }
+      
+      flushExecutor();
 
       if (log.isDebugEnabled())
       {
@@ -1358,6 +1367,16 @@
 
       return str.toString();
    }
+   
+   private void flushExecutor()
+   {
+      Future future = new Future();
+      executor.execute(future);
+      if (!future.await(10000))
+      {
+         server.threadDump("Couldn't finish executor on " + this);
+      }
+   }
 
    interface ClusterConnector
    {



More information about the hornetq-commits mailing list