[jboss-cvs] JBoss Messaging SVN: r8205 - in branches/JBM1842: integration/EAP4/etc/xmdesc and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 1 19:56:48 EST 2011


Author: gaohoward
Date: 2011-02-01 19:56:47 -0500 (Tue, 01 Feb 2011)
New Revision: 8205

Added:
   branches/JBM1842/integration/EAP4/etc/server/default/deploy/messaging-cluster-health-mbean-service.xml
   branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingClusterHealthMBean-xmbean.xml
   branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
Modified:
   branches/JBM1842/integration/EAP4/etc/xmdesc/ServerPeer-xmbean.xml
   branches/JBM1842/src/main/org/jboss/jms/server/ServerPeer.java
   branches/JBM1842/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
   branches/JBM1842/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
   branches/JBM1842/src/main/org/jboss/messaging/core/contract/PersistenceManager.java
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/NullPersistenceManager.java
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
save


Added: branches/JBM1842/integration/EAP4/etc/server/default/deploy/messaging-cluster-health-mbean-service.xml
===================================================================
--- branches/JBM1842/integration/EAP4/etc/server/default/deploy/messaging-cluster-health-mbean-service.xml	                        (rev 0)
+++ branches/JBM1842/integration/EAP4/etc/server/default/deploy/messaging-cluster-health-mbean-service.xml	2011-02-02 00:56:47 UTC (rev 8205)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     The JBoss Messaging service deployment descriptor.
+
+     $Id: messaging-service.xml 3881 2008-03-14 16:01:43Z timfox $
+ -->
+
+<server>
+
+   <!-- MessagingClusterHealthMBean MBean configuration
+        ============================== -->
+
+   <mbean code="org.jboss.jms.server.MessagingClusterHealthMBean"
+      name="jboss.messaging:service=MessagingClusterHealthMBean"
+      xmbean-dd="xmdesc/MessagingClusterHealthMBean-xmbean.xml">
+
+      <!-- The service name of Server Peer -->
+
+      <attribute name="ServerPeer">jboss.messaging:service=ServerPeer</attribute>
+      
+      <!-- The service name of Post Office --> 
+      
+      <attribute name="PostOffice">jboss.messaging:service=PostOffice</attribute>
+
+      <!-- The service name of Persistence Manager -->
+
+      <attribute name="PersistenceManager">jboss.messaging:service=PersistenceManager</attribute>
+
+   </mbean>
+
+</server>

Added: branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingClusterHealthMBean-xmbean.xml
===================================================================
--- branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingClusterHealthMBean-xmbean.xml	                        (rev 0)
+++ branches/JBM1842/integration/EAP4/etc/xmdesc/MessagingClusterHealthMBean-xmbean.xml	2011-02-02 00:56:47 UTC (rev 8205)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+   <!DOCTYPE mbean PUBLIC
+      "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
+      "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd">
+<mbean>
+   <description>JBoss Messaging Cluster Health MBean</description>
+   <class>org.jboss.jms.server.MessagingClusterHealthMBean</class>
+
+   <!-- Managed constructors -->
+
+   <constructor>
+      <name>MessagingClusterHealthMBean</name>
+   </constructor>
+
+   <!-- Managed attributes -->
+
+   <attribute access="read-only" getMethod="getInstance">
+      <description>The instance to plug into the server peer</description>
+      <name>Instance</name>
+      <type>java.lang.Object</type>
+   </attribute>
+
+   <attribute access="read-write" getMethod="getServerPeer" setMethod="setServerPeer">
+      <description>The name of server peer service</description>
+      <name>ServerPeer</name>
+      <type>java.lang.String</type>
+   </attribute>
+
+   <attribute access="read-write" getMethod="getPostOffice" setMethod="setPostOffice">
+      <description>The name of post office service</description>
+      <name>PostOffice</name>
+      <type>java.lang.String</type>
+   </attribute>
+
+   <attribute access="read-write" getMethod="getPersistenceManager" setMethod="setPersistenceManager">
+      <description>The name of persistence service</description>
+      <name>PersistenceManager</name>
+      <type>java.lang.String</type>
+   </attribute>
+
+   <!-- Managed operations -->
+
+   <operation>
+      <description>JBoss Service lifecycle operation</description>
+      <name>create</name>
+   </operation>
+
+   <operation>
+      <description>JBoss Service lifecycle operation</description>
+      <name>start</name>
+   </operation>
+
+   <operation>
+      <description>JBoss Service lifecycle operation</description>
+      <name>stop</name>
+   </operation>
+
+   <operation>
+      <description>JBoss Service lifecycle operation</description>
+      <name>destroy</name>
+   </operation>
+
+</mbean>

Modified: branches/JBM1842/integration/EAP4/etc/xmdesc/ServerPeer-xmbean.xml
===================================================================
--- branches/JBM1842/integration/EAP4/etc/xmdesc/ServerPeer-xmbean.xml	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/integration/EAP4/etc/xmdesc/ServerPeer-xmbean.xml	2011-02-02 00:56:47 UTC (rev 8205)
@@ -33,6 +33,12 @@
       <name>JMSUserManager</name>
       <type>javax.management.ObjectName</type>
    </attribute>   
+   
+   <attribute access="read-write" getMethod="getMessagingClusterHealthMBean" setMethod="setMessagingClusterHealthMBean">
+      <description>The ObjectName of the MessagingClusterHealthMBean</description>
+      <name>MessagingClusterHealthMBean</name>
+      <type>javax.management.ObjectName</type>
+   </attribute>
          
    <!-- instance access -->
 

Added: branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java	                        (rev 0)
+++ branches/JBM1842/src/main/org/jboss/jms/server/MessagingClusterHealthMBean.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -0,0 +1,335 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2011, Red Hat Middleware LLC, and individual contributors
+ * 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.jms.server;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import org.jboss.logging.Logger;
+import org.jboss.messaging.core.contract.PersistenceManager;
+import org.jboss.messaging.core.impl.postoffice.MessagingPostOffice;
+import org.jboss.messaging.util.JMXAccessor;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * A MessagingClusterHealthMBean
+ *
+ * @author <a href="mailto:hgao at redhat.com">Howard Gao</a>
+ * 
+ * Created Jan 31, 2011 8:52:02 PM
+ *
+ *
+ */
+public class MessagingClusterHealthMBean extends ServiceMBeanSupport
+{
+   private static final Logger log = Logger.getLogger(MessagingClusterHealthMBean.class);
+   
+   private String serverPeer;
+   private String postOffice;
+   private List<ObjectName> connectionFactories;
+   private List<ObjectName> destinations;
+   private String persistenceManager;
+   
+   private boolean nodeStopped;
+   
+   private NodeRecovery nodeRecovery;
+   
+   private long stopTime;
+   
+   private long shutdownDelay;
+
+   public void startService() throws Exception
+   {
+      connectionFactories = new ArrayList<ObjectName>();
+      destinations = new ArrayList<ObjectName>();
+      
+      nodeRecovery = new NodeRecovery();
+      log.info(this + " started.");
+   }
+   
+   public void stopService() throws Exception
+   {
+      setServerPeer(null);
+      setPostOffice(null);
+      setPersistenceManager(null);
+      connectionFactories.clear();
+      destinations.clear();
+      
+      nodeRecovery.abandon();
+      nodeRecovery = null;
+      log.info(this + " stopped.");
+   }
+   
+   public Object getInstance()
+   {
+      return this;
+   }
+   
+   public synchronized void stopNodeOnDBFailure() throws Exception
+   {
+      if (nodeStopped) return;
+
+      log.info("Stopping JBM node on DB failure...");
+            
+      //destinations
+      stopServices(destinations);
+      
+      //connection factories
+      stopServices(connectionFactories);
+      
+      //post office
+      ObjectName postOfficeServiceName = new ObjectName(postOffice);
+      getShutdownDelay(postOfficeServiceName);
+      stopService(postOfficeServiceName);
+      
+      //server peer
+      ObjectName serverPeerName = new ObjectName(serverPeer);
+      stopService(serverPeerName);
+      
+      nodeStopped = true;
+      
+      nodeRecovery.start();
+      
+      stopTime = System.currentTimeMillis();
+      
+      log.info("JBM node is stopped.");
+   }
+
+   private void getShutdownDelay(ObjectName postOfficeServiceName)
+   {
+      try
+      {
+         long nodeRefreshInterval = (Long)server.invoke(postOfficeServiceName, "getNodeStateRefreshInterval", new Object[0], new String[0]);
+         shutdownDelay = nodeRefreshInterval * 2;
+      }
+      catch (Exception e)
+      {
+         log.warn("Failed to get node refresh interval, use default.", e);
+         shutdownDelay = 30000;
+      }
+   }
+
+   private void stopService(ObjectName service) throws Exception
+   {
+      try
+      {
+         server.invoke(service, "stop", new Object[0], new String[0]);
+         log.debug("Service " + serviceName + " stopped.");
+      }
+      catch (Exception e)
+      {
+         log.warn("Error stopping service " + serviceName, e);
+      }      
+   }
+
+   private void stopServices(List<ObjectName> services) throws Exception
+   {
+      Iterator<ObjectName> iter = services.iterator();
+      
+      while (iter.hasNext())
+      {
+         ObjectName serviceName = iter.next();
+         stopService(serviceName);
+      }
+   }
+
+   public void setServerPeer(String serverPeer)
+   {
+      this.serverPeer = serverPeer;
+   }
+
+   public String getServerPeer()
+   {
+      return serverPeer;
+   }
+
+   public void setPostOffice(String postOffice)
+   {
+      this.postOffice = postOffice;
+   }
+
+   public String getPostOffice()
+   {
+      return postOffice;
+   }
+
+   public void setPersistenceManager(String persistenceManager)
+   {
+      this.persistenceManager = persistenceManager;
+   }
+
+   public String getPersistenceManager()
+   {
+      return persistenceManager;
+   }
+   
+   private boolean checkDBConnection() throws Exception
+   {
+      ObjectName pmName = new ObjectName(persistenceManager);
+      
+      PersistenceManager pm = (PersistenceManager)JMXAccessor.getJMXAttributeOverSecurity(server, pmName, "Instance");
+
+      boolean isConnOK = false;
+      try
+      {
+         isConnOK = pm.checkConnection();
+      }
+      catch (Exception e)
+      {
+         log.warn("failed to check connection", e);
+         isConnOK = false;
+      }
+      return isConnOK;
+   }
+   
+   private synchronized void restartJBMNode() throws Exception
+   {
+      if (!nodeStopped) return;
+      
+      makeSureDelay();
+      
+      log.info("Restarting JBM node...");
+      
+      //start server peer
+      ObjectName spName = new ObjectName(serverPeer);
+      startService(spName);
+      
+      //starat post office
+      ObjectName poName = new ObjectName(postOffice);
+      startService(poName);
+      
+      List<ObjectName> copy = new ArrayList<ObjectName>(connectionFactories);
+      connectionFactories.clear();
+      //start cf
+      startServices(copy);
+      
+      copy = new ArrayList<ObjectName>(destinations);
+      destinations.clear();
+      //destinations
+      startServices(copy);
+
+      nodeStopped = false;
+      
+      log.info("JBM node restarted.");
+   }
+   
+   private void makeSureDelay()
+   {
+      long delay = System.currentTimeMillis() - stopTime;
+      while (delay < shutdownDelay)
+      {
+         try
+         {
+            Thread.sleep(shutdownDelay - delay);
+         }
+         catch (InterruptedException e)
+         {
+         }
+         delay = System.currentTimeMillis() - stopTime;
+      }
+      
+   }
+   private void startService(ObjectName serviceName) throws Exception
+   {
+      server.invoke(serviceName, "start", new Object[0], new String[0]);
+      log.debug("Service " + serviceName + " started.");
+   }
+
+   private void startServices(List<ObjectName> services) throws Exception
+   {
+      Iterator<ObjectName> iter = services.iterator();
+      
+      while (iter.hasNext())
+      {
+         ObjectName serviceName = iter.next();
+         startService(serviceName);
+      }
+   }
+
+   private class NodeRecovery extends Thread
+   {
+      private boolean keepTrying = true;
+      
+      public NodeRecovery()
+      {
+      }
+      
+      public synchronized void abandon()
+      {
+         keepTrying = false;
+         notify();
+      }
+
+      public synchronized void run()
+      {
+         try
+         {
+            while (keepTrying)
+            {
+               if (checkDBConnection())
+               {
+                  restartJBMNode();
+                  break;
+               }
+               try
+               {
+                  wait(5000);
+               }
+               catch (InterruptedException e)
+               {
+                  //ignore.
+               }
+            }
+         }
+         catch (Exception e)
+         {
+            log.error("Getting exception, stop recovery.", e);
+         }
+      }
+   }
+
+   public void registerFactory(ObjectName serviceName)
+   {
+      synchronized(connectionFactories)
+      {
+         connectionFactories.add(serviceName);
+         log.info("Registered connection factory " + serviceName);
+      }
+   }
+
+   public void registerDestination(ObjectName serviceName)
+   {
+      synchronized(destinations)
+      {
+         destinations.add(serviceName);
+         log.info("Registered destination " + serviceName);
+      }
+   }
+}

Modified: branches/JBM1842/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/jms/server/ServerPeer.java	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/jms/server/ServerPeer.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -215,6 +215,9 @@
 
    protected ObjectName jmsUserManagerObjectName;
    protected JMSUserManager jmsUserManager;
+   
+   protected ObjectName messagingClusterHealthMBeanObjectName;
+   protected MessagingClusterHealthMBean clusterHealthBean;
 
    protected ObjectName defaultDLQObjectName;
    protected Queue defaultDLQ;
@@ -360,8 +363,10 @@
          	startMessageCounters();
          }
 
+         initClusterHealthBean();
+         
          started = true;
-
+         
          log.info("JBoss Messaging " + getVersion().getProviderVersion() + " server [" +
             getServerPeerID()+ "] started");
       }
@@ -480,6 +485,21 @@
       jmsUserManagerObjectName = on;
    }
 
+   public synchronized ObjectName getMessagingClusterHealthMBean()
+   {
+      return messagingClusterHealthMBeanObjectName;
+   }
+
+   public synchronized void setMessagingClusterHealthMBean(ObjectName on)
+   {
+      if (started)
+      {
+         log.warn("Cannot set messaging cluster health mbean on server peer when server peer is started");
+         return;
+      }
+      messagingClusterHealthMBeanObjectName = on;
+   }
+
    public synchronized ObjectName getDefaultDLQ()
    {
       return defaultDLQObjectName;
@@ -2047,6 +2067,75 @@
       }
    }
 
+   private void initClusterHealthBean()
+   {
+      if (this.messagingClusterHealthMBeanObjectName != null)
+      {
+         try
+         {
+            clusterHealthBean = (MessagingClusterHealthMBean)JMXAccessor.getJMXAttributeOverSecurity(getServer(),
+                                                                                                     messagingClusterHealthMBeanObjectName,
+                                                                                                     "Instance");
+         }
+         catch (Exception e)
+         {
+            log.warn("Failed to get MessagingClusterHealthMBean instance.", e);
+            clusterHealthBean = null;
+         }
+      }
+   }
+   
+   public void stopJBMNodeForRecovery()
+   {
+      if (clusterHealthBean != null)
+      {
+         try
+         {
+            clusterHealthBean.stopNodeOnDBFailure();
+         }
+         catch (Exception e)
+         {
+            log.error("Failed to stop node for DB failure, need to manually restart node.", e);
+            try
+            {
+               this.stopService();
+            }
+            catch (Exception e1)
+            {
+               log.error("Failed to stop server peer.", e1);
+            }
+         }
+      }
+      else
+      {
+         log.warn(" mbean " + messagingClusterHealthMBeanObjectName + " not deployed! You need manually restart the node.");
+         try
+         {
+            this.stopService();
+         }
+         catch (Exception e1)
+         {
+            log.error("Failed to stop server peer.", e1);
+         }
+      }
+   }
+
+   public void registerCFForRecovery(ObjectName serviceName)
+   {
+      if (clusterHealthBean != null)
+      {
+         clusterHealthBean.registerFactory(serviceName);
+      }
+   }
+
+   public void registerDestForRecovery(ObjectName serviceName)
+   {
+      if (clusterHealthBean != null)
+      {
+         clusterHealthBean.registerDestination(serviceName);
+      }
+   }
+
    // Inner classes --------------------------------------------------------------------------------
 
 

Modified: branches/JBM1842/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -223,6 +223,8 @@
          }
       
          log.info(info);
+         
+         serverPeer.registerCFForRecovery(serviceName);
          log.info(this + " started");
       }
       catch (Throwable t)

Modified: branches/JBM1842/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -139,6 +139,8 @@
          {
             setExpiryQueue(expiryQueueObjectName);
          }
+         
+         serverPeer.registerDestForRecovery(serviceName);
       }
       catch (Throwable t)
       {

Modified: branches/JBM1842/src/main/org/jboss/messaging/core/contract/PersistenceManager.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/contract/PersistenceManager.java	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/contract/PersistenceManager.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -104,6 +104,9 @@
 
    //update messages state to 'C' of the channel whose state is 'S', and return their messages ids
    List<ReferenceInfo> claimMessagesInSuck(long channelID) throws Exception;
+   
+   //check if the connection is ok
+   boolean checkConnection();
 
    // Interface value classes ----------------------------------------------------------------------
 

Modified: branches/JBM1842/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -3446,4 +3446,33 @@
       return msgIDs;
    }
 
+   public boolean checkConnection()
+   {
+      Connection connection = null;
+      try
+      {
+         connection = ds.getConnection();
+         return connection != null;
+      }
+      catch (Throwable e)
+      {
+         log.warn("Check connection failed ", e);
+         return false;
+      }
+      finally
+      {
+         if (connection != null)
+         {
+            try
+            {
+               connection.close();
+            }
+            catch (SQLException e)
+            {
+               log.warn("Error closing connection", e);
+            }
+         }
+      }
+   }
+
 }

Modified: branches/JBM1842/src/main/org/jboss/messaging/core/impl/NullPersistenceManager.java
===================================================================
--- branches/JBM1842/src/main/org/jboss/messaging/core/impl/NullPersistenceManager.java	2011-02-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/NullPersistenceManager.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -237,6 +237,11 @@
       return Collections.emptyList();
    }
 
+   public boolean checkConnection()
+   {
+      return true;
+   }
+
 }
 
 class IDCounter

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-01 17:54:05 UTC (rev 8204)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-02-02 00:56:47 UTC (rev 8205)
@@ -661,6 +661,31 @@
             }
          }
       }
+      //if I am quarantined, but the current view is not one member. That means 
+      //I missed the startup time join (jgroups was still bad then), but later jgroups is back
+      //to normal, so I get this chance do rejoin.
+      if (clusterState.isQuarantined(thisNodeID))
+      {
+         View currView = groupMember.getCurrentView();
+         if ((currView != null) && currView.getMembers().size() > 1)
+         {
+            PostOfficeAddressInfo info = new PostOfficeAddressInfo(groupMember.getControlChannelAddress(),
+                                                                   groupMember.getDataChannelAddress());
+            try
+            {
+               String clientVMId = JMSClientVMIdentifier.instance;
+               //add our vm identifier to the replicator
+               put(Replicator.JVM_ID_KEY, clientVMId);
+
+               groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
+               updateStateInStorage(thisNodeID, STATE_CLUSTERED, true);
+            }
+            catch (Exception e)
+            {
+               log.error("error sending node join request!", e);
+            }
+         }
+      }
    }
    
    //timestamp and query the new state from db
@@ -1457,8 +1482,8 @@
                PostOfficeAddressInfo info = new PostOfficeAddressInfo(groupMember.getControlChannelAddress(), groupMember.getDataChannelAddress());
                try
                {
+                  groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
                   updateStateInStorage(thisNodeID, STATE_CLUSTERED, true);
-                  groupMember.multicastControl(new JoinClusterRequest(thisNodeID, info), true);
                }
                catch (Exception e)
                {
@@ -1646,7 +1671,7 @@
             catch (Exception e)
             {
                log.error("Having problem update myself. Shutting down to avoid message duplicated delivery.");
-               this.serverPeer.stopService();
+               this.serverPeer.stopJBMNodeForRecovery();
                return;
             }
          }
@@ -2646,7 +2671,7 @@
 
             groupMember.multicastControl(request, sync);
          }      	
-      }      
+      }
       
       return added;
    }   
@@ -4033,6 +4058,19 @@
    {
       private boolean working = true;
       
+      public StateMonitor()
+      {
+         //force once
+         try
+         {
+            refreshNodeState();
+         }
+         catch (Exception e)
+         {
+            log.warn("first time refreshing node state error", e);
+         }
+      }
+      
       public synchronized void run()
       {
          do
@@ -4049,7 +4087,7 @@
                else if (clusterState.isQuarantined(thisNodeID))
                {
                   log.error("I'm orphaned and now I can't tell others that I'm alive. Shutdown node: " + thisNodeID);
-                  serverPeer.stopService();
+                  serverPeer.stopJBMNodeForRecovery();
                   working = false;
                   nodeStateRefreshInterval = 1; //let the thread quite quickly.
                }
@@ -4226,6 +4264,5 @@
    {
       groupMember.unregisterChannelInJmx(server, channelPartitionName);
    }
-
    
 }



More information about the jboss-cvs-commits mailing list