[jboss-cvs] JBoss Messaging SVN: r8213 - branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Feb 6 04:51:47 EST 2011


Author: gaohoward
Date: 2011-02-06 04:51:47 -0500 (Sun, 06 Feb 2011)
New Revision: 8213

Modified:
   branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
back port


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 09:18:13 UTC (rev 8212)
+++ branches/JBM1842/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2011-02-06 09:51:47 UTC (rev 8213)
@@ -601,12 +601,14 @@
       while (iter.hasNext())
       {
          Integer qNodeID = iter.next();
+         log.debug("Processing cluster state for node " + qNodeID);
          
          Boolean isDead = clusterStateCopy.isNodeDead(qNodeID);
          
          if (isDead == null)
          {
             //someone else done the job.
+            log.debug("Cluster state for node " + qNodeID + " was removed from the database; removing local information now.");
             cleanDataForNode(qNodeID);
             suspectedNodes.remove(qNodeID);
          }
@@ -713,8 +715,17 @@
                ps.setLong(1, System.currentTimeMillis());
                ps.setInt(2, thisNodeID);
 
-               ps.executeUpdate();
-               
+               int result = ps.executeUpdate();
+
+               if (result > 0)
+               {
+                  log.debug("Successfully updated cluster health timestamp for node " + thisNodeID);
+               }
+               else if (result == 0)
+               {
+                  log.debug("Cluster health timestamp update for node " + thisNodeID + " failed!");
+               }
+
                timestampDone = true;
 
                synchronized (clusterState)
@@ -722,15 +733,16 @@
                   clusterState.clear();
                   // collect states
                   ps = conn.prepareStatement(getSQLStatement("LOAD_CLUSTER_STATE"));
-                  ResultSet result = ps.executeQuery();
+                  ResultSet res = ps.executeQuery();
 
-                  while (result.next())
+                  while (res.next())
                   {
-                     int nodeID = result.getInt(1);
-                     long timestamp = result.getLong(2);
-                     int nodeState = result.getInt(3);
+                     int nodeID = res.getInt(1);
+                     long timestamp = res.getLong(2);
+                     int nodeState = res.getInt(3);
 
                      clusterState.addNode(nodeID, timestamp, nodeState);
+                     log.debug("Added cluster node state: nodeID = " + nodeID + ", timestamp = " + timestamp + ", nodeState = " + nodeState);
                   }
                }
             }
@@ -4236,8 +4248,10 @@
          long stampAge = currentTime - timestamp;
          if (stampAge > (2 * nodeStateRefreshInterval))
          {
+            log.debug("Timestamp age of " + stampAge + "ms exceeds limit of " + (2 * nodeStateRefreshInterval) + "ms; treating node as dead.");
             return true;
          }
+         log.debug("Timestamp age of " + stampAge + "ms is under limit of " + (2 * nodeStateRefreshInterval) + "ms; treating node as healthy.");
          return false;
       }
    }



More information about the jboss-cvs-commits mailing list