[jboss-cvs] JBossAS SVN: r107217 - projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/sso.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 29 16:05:49 EDT 2010


Author: smarlow at redhat.com
Date: 2010-07-29 16:05:49 -0400 (Thu, 29 Jul 2010)
New Revision: 107217

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/sso/SSOClusterManagerImpl.java
Log:
JBCLUSTER-286 only the master node will cleanup up after dead cluster members

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/sso/SSOClusterManagerImpl.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/sso/SSOClusterManagerImpl.java	2010-07-29 19:59:37 UTC (rev 107216)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/sso/SSOClusterManagerImpl.java	2010-07-29 20:05:49 UTC (rev 107217)
@@ -142,6 +142,8 @@
     */
    private volatile Object localAddress = null;
 
+   private volatile boolean masterNode = false;
+
    /**
     * The new members of the last view passed to viewChange()
     * TODO:  figure out how to get cluster view members at startup time
@@ -540,6 +542,16 @@
          if (localAddress == null || !currentView.contains(localAddress))
             return;
 
+         // treat the first node in the view as the master node
+         if (currentView.iterator().next().equals(localAddress))
+         {
+            masterNode = true;
+         }
+         else
+         {
+            masterNode = false;
+         }
+
          // Remove all the current members from the old set; any left
          // are the dead members
          oldMembers.removeAll(currentView);
@@ -1069,14 +1081,19 @@
          {
             try
             {
-               // Ensure we have a TransactionManager
-               if (tm == null)
-                  configureFromCache();
+               // only do this clean up work on the master node (instead of burning cycles on every node)
+               if (masterNode)
+               {
+                  log.debug("check if we have to clean up SSO for any members that left the cluster.");
+                  // Ensure we have a TransactionManager
+                  if (tm == null)
+                     configureFromCache();
 
-               Set<String> ids = getSSOIds();
-               for (String sso : ids)
-               {
-                  cleanSSO(sso);
+                  Set<String> ids = getSSOIds();
+                  for (String sso : ids)
+                  {
+                     cleanSSO(sso);
+                  }
                }
             }
             catch (Exception e)
@@ -1115,10 +1132,7 @@
                         log.trace("Removing peer " + fullyQualifiedSessionId + " from SSO " + ssoId);
                      }
 
-                     // Remove the peer node, but local-only
-                     // Each cache is responsible for cleaning itself
-                     // TODO:  either make the following local only or only
-                     // do the remove on the master cluster node.
+                     // Remove the peer node
                      removeSessionFromCache(ssoId, fullyQualifiedSessionId);
                   }
                }



More information about the jboss-cvs-commits mailing list