[jboss-cvs] JBossAS SVN: r57329 - branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/sso

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 1 18:35:46 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-10-01 18:35:46 -0400 (Sun, 01 Oct 2006)
New Revision: 57329

Modified:
   branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/sso/ClusteredSingleSignOn.java
Log:
Improve logging
Ensure we keep the emptySSOs map clean

Modified: branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/sso/ClusteredSingleSignOn.java
===================================================================
--- branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/sso/ClusteredSingleSignOn.java	2006-10-01 22:02:18 UTC (rev 57328)
+++ branches/Branch_4_0/tomcat/src/main/org/jboss/web/tomcat/tc5/sso/ClusteredSingleSignOn.java	2006-10-01 22:35:46 UTC (rev 57329)
@@ -801,6 +801,11 @@
       if (getContainer().getLogger().isDebugEnabled())
           getContainer().getLogger().debug("Deregistering sso id '" + ssoId + "'");
 
+      
+      // It's possible we don't have the SSO locally but it's in
+      // the emptySSOs map; if so remove it
+      emptySSOs.remove(ssoId);
+      
       // Look up and remove the corresponding SingleSignOnEntry
       SingleSignOnEntry sso = null;
       synchronized (cache)
@@ -815,8 +820,8 @@
       Session sessions[] = sso.findSessions();
       for (int i = 0; i < sessions.length; i++)
       {
-         if (getContainer().getLogger().isTraceEnabled())
-             getContainer().getLogger().trace(" Invalidating session " + sessions[i]);
+         if (getContainer().getLogger().isDebugEnabled())
+             getContainer().getLogger().debug(" Invalidating session " + sessions[i]);
          // Remove from reverse cache first to avoid recursion
          synchronized (reverse)
          {
@@ -1164,7 +1169,12 @@
     */
    void notifySSOEmpty(String ssoId)
    {
-      emptySSOs.put(ssoId, new Long(System.currentTimeMillis()));
+      Object obj = emptySSOs.put(ssoId, new Long(System.currentTimeMillis()));
+      
+      if (obj == null && getContainer().getLogger().isDebugEnabled())
+      {
+         getContainer().getLogger().debug("Notified that SSO " + ssoId + " is empty");
+      }
    }
    
    /**
@@ -1173,7 +1183,13 @@
     */
    void notifySSONotEmpty(String ssoId)
    {
-      emptySSOs.remove(ssoId);
+      Object obj = emptySSOs.remove(ssoId);
+      
+      if (obj != null && getContainer().getLogger().isDebugEnabled())
+      {
+         getContainer().getLogger().debug("Notified that SSO " + ssoId + 
+                                          " is no longer empty");
+      }
    }
 
    
@@ -1261,8 +1277,12 @@
          Map.Entry entry = (Map.Entry) iter.next();
          if ( (now - ((Long) entry.getValue()).longValue()) > maxEmptyLife)
          {
-            logout((String) entry.getKey());
-            iter.remove();
+            String ssoId = (String) entry.getKey();
+            if (getContainer().getLogger().isDebugEnabled())
+            {
+               getContainer().getLogger().debug("Invalidating expired SSO " + ssoId);
+            }
+            logout(ssoId);
          }
       }      
    }
@@ -1277,8 +1297,13 @@
                && (System.currentTimeMillis() - expired.longValue()) > maxEmptyLife)
          {
             valid = false;
+            
+            if (getContainer().getLogger().isDebugEnabled())
+            {
+               getContainer().getLogger().debug("Invalidating expired SSO " + ssoId);
+            }
+            
             logout(ssoId);
-            emptySSOs.remove(ssoId);
          }
       }
       




More information about the jboss-cvs-commits mailing list