[jboss-cvs] JBossAS SVN: r81709 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/session.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 27 05:13:42 EST 2008


Author: bstansberry at jboss.com
Date: 2008-11-27 05:13:42 -0500 (Thu, 27 Nov 2008)
New Revision: 81709

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
Log:
[JBAS-5941] Deal w/ ISE out of loadSession; avoid improper gravitation during passivation that likely leads to it
[JBAS-6162] Handle case where session being passivated has been expired

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2008-11-27 10:12:10 UTC (rev 81708)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2008-11-27 10:13:42 UTC (rev 81709)
@@ -892,6 +892,10 @@
     * Notifies the manager that a session in the distributed cache has
     * been invalidated
     * 
+    * FIXME This method is poorly named, as we will also get this callback
+    * when we use buddy replication and our copy of the session in JBC is being
+    * removed due to data gravitation.
+    * 
     * @param realId the session id excluding any jvmRoute
     */
    public void notifyRemoteInvalidation(String realId)
@@ -922,12 +926,15 @@
          boolean notify = false; // Don't notify listeners. SRV.10.7
                                  // allows this, and sending notifications
                                  // leads to all sorts of issues; e.g.
-                                 // circular calls with ClusteredSSO
+                                 // circular calls with ClusteredSSO and
+                                 // notifying when all that's happening is
+                                 // data gravitation due to random failover
          boolean localCall = false; // this call originated from the cache;
                                     // we have already removed session
          boolean localOnly = true; // Don't pass attr removals to cache
          
          // Ensure the correct TCL is in place
+         // BES 2008/11/27 Why?
          ContextClassLoaderSwitcher.SwitchContext switcher = null;
          try
          {
@@ -1225,6 +1232,11 @@
                   // session from the cache in case that might change the timeout
                   if (session.isOutdated() && !(session.isValid(false)))
                   {
+                     // FIXME in AS 5 every time we get a notification from the distributed
+                     // cache of an update, we get the latest timestamp. So
+                     // we shouldn't need to do a full session load here. A load
+                     // adds a risk of an unintended data gravitation.
+                     
                      // JBAS-2792 don't assign the result of loadSession to session
                      // just update the object from the cache or fall through if
                      // the session has been removed from the cache
@@ -1277,6 +1289,7 @@
             {
                if (expire && osu.maxInactive >= 1 && elapsed >= (osu.maxInactive + maxUnrep) * 1000L)
                {
+                  //if (osu.passivated && osu.owner == null)
                   if (osu.passivated)
                   {
                      // Passivated session needs to be expired. A call to 
@@ -1289,8 +1302,8 @@
                      }
                   }
                   
-                  // If we get here either !osu.passivated, or the session
-                  // couldn't be reactivated (invalidated by user). 
+                  // If we get here either !osu.passivated, or we don't own
+                  // the session or the session couldn't be reactivated (invalidated by user). 
                   // Either way, do a cleanup
                   proxy_.removeSessionLocal(realId, osu.owner);
                   unloadedSessions_.remove(realId);
@@ -1505,9 +1518,17 @@
             // so we need to do it :(
             switcher = getContextClassLoaderSwitcher().getSwitchContext();
             switcher.setClassLoader(tcl_);
+                        
+            try
+            {
+               session = proxy_.loadSession(realId, session);
+            }
+            catch (IllegalStateException ise) // FIXME do this in the ha-server-cache-jbc layer
+            {
+               log_.warn("Aborting load due to invalid session state in the distributed cache for " + 
+                     realId + " -- " + ise.getLocalizedMessage());
+            }
             
-            session = proxy_.loadSession(realId, session);
-            
             if (session != null)
             {
                ClusteredSessionNotificationCause cause = passivated ? ClusteredSessionNotificationCause.ACTIVATION 
@@ -1684,7 +1705,7 @@
             // Put the session in the unloadedSessions map. This will
             // expose the session to regular invalidation.
             Object obj = unloadedSessions_.put(realId, 
-                  new OwnedSessionUpdate(null, session.getLastAccessedTime(), session.getMaxInactiveInterval(), true));
+                  new OwnedSessionUpdate(null, session.getLastAccessedTimeInternal(), session.getMaxInactiveInterval(), true));
             if (trace_)
             {
                if (obj == null)




More information about the jboss-cvs-commits mailing list