[jboss-cvs] JBossAS SVN: r108589 - branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 14 16:37:50 EDT 2010


Author: smarlow at redhat.com
Date: 2010-10-14 16:37:50 -0400 (Thu, 14 Oct 2010)
New Revision: 108589

Modified:
   branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonController.java
   branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonElectionPolicySimple.java
Log:
debug logging

Modified: branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonController.java
===================================================================
--- branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonController.java	2010-10-14 19:50:23 UTC (rev 108588)
+++ branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonController.java	2010-10-14 20:37:50 UTC (rev 108589)
@@ -152,6 +152,7 @@
    @Override
    public void startSingleton()
    {
+      log.debug("starting singleton, mSingleton=" + mSingleton +", mSingletonMBean=" + mSingletonMBean);
       super.startSingleton();
 
       try

Modified: branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonElectionPolicySimple.java
===================================================================
--- branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonElectionPolicySimple.java	2010-10-14 19:50:23 UTC (rev 108588)
+++ branches/infinispan-int/cluster/src/main/java/org/jboss/ha/singleton/HASingletonElectionPolicySimple.java	2010-10-14 20:37:50 UTC (rev 108589)
@@ -26,6 +26,7 @@
 
 import org.jboss.ha.framework.interfaces.ClusterNode;
 import org.jboss.ha.framework.interfaces.HASingletonElectionPolicy;
+import org.jboss.logging.Logger;
 
 /**
  * A simple concrete policy service that decides which node in the cluster should be 
@@ -60,6 +61,7 @@
 {
    // Attributes
    private int mPosition = 0; // Default
+   private static Logger LOG = Logger.getLogger(HASingletonElectionPolicySimple.class);
    
    /**
     * @see HASingletonElectionPolicySimpleMBean#setPosition(int)
@@ -81,7 +83,13 @@
    {
       int size = candidates.size();
       int remainder = ((this.mPosition % size) + size) % size;
-      
-      return candidates.get(remainder);
+      ClusterNode result = candidates.get(remainder);
+      if (LOG.isDebugEnabled())
+      {
+         LOG.debug("election with " + size + " nodes and position=" +
+            mPosition + ", will choose node[" +remainder+"] picked node ip=" +
+            result.getIpAddress() + " port=" + result.getPort());
+      }
+      return result;
    }
 }



More information about the jboss-cvs-commits mailing list