[jboss-cvs] JBoss Messaging SVN: r8211 - in branches/JBM1842/src/main/org/jboss: messaging/core/impl/postoffice and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Feb 6 04:15:25 EST 2011


Author: gaohoward
Date: 2011-02-06 04:15:24 -0500 (Sun, 06 Feb 2011)
New Revision: 8211

Modified:
   branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
save


Modified: branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java	2011-02-06 02:10:55 UTC (rev 8210)
+++ branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java	2011-02-06 09:15:24 UTC (rev 8211)
@@ -225,6 +225,10 @@
       ObjectName poName = new ObjectName(postOffice);
       startService(poName);
       
+      //wait for jgroups back
+      MessagingPostOffice pm = (MessagingPostOffice)JMXAccessor.getJMXAttributeOverSecurity(server, poName, "Instance");
+      pm.waitForJGroups();
+      
       List<ObjectName> copy = new ArrayList<ObjectName>(connectionFactories);
       connectionFactories.clear();
       //start cf

Modified: branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-02-06 02:10:55 UTC (rev 8210)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-02-06 09:15:24 UTC (rev 8211)
@@ -265,6 +265,8 @@
    private long nodeStateRefreshInterval = 30000;
    
    private boolean keepOldFailoverModel = true;
+   
+   private Object jgroupsLock = new Object();
 
    
    // Constructors ---------------------------------------------------------------------------------
@@ -2776,7 +2778,12 @@
       	{
       		failoverNodeID = fid;
       		firstNode = false;	   		
-      	}	  
+      	}
+      	
+      	synchronized (jgroupsLock)
+      	{
+      	   jgroupsLock.notify();
+      	}
    	}
    	else
    	{
@@ -4187,6 +4194,11 @@
          
          return nState.isDead();
       }
+
+      public int nodeNum()
+      {
+         return states.size();
+      }
    }
    
    private class NodeState
@@ -4264,5 +4276,23 @@
    {
       groupMember.unregisterChannelInJmx(server, channelPartitionName);
    }
+
+   public void waitForJGroups()
+   {
+      synchronized (jgroupsLock)
+      {
+         //if I am alone but there are still others there
+         while (isFirstNode() && (clusterState.nodeNum() > 1))
+         {
+            try
+            {
+               jgroupsLock.wait(5000);
+            }
+            catch (InterruptedException e)
+            {
+            }
+         }
+      }
+   }
    
 }



More information about the jboss-cvs-commits mailing list