[jboss-cvs] JBossAS SVN: r60307 - branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 5 16:04:22 EST 2007


Author: bstansberry at jboss.com
Date: 2007-02-05 16:04:22 -0500 (Mon, 05 Feb 2007)
New Revision: 60307

Modified:
   branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
Log:
[JBAS-4067] Detect collection modifications in FIELD pojos
Reduce calls to log.isTraceEnabled()

Modified: branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2007-02-05 20:15:45 UTC (rev 60306)
+++ branches/Branch_4_2/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossCacheManager.java	2007-02-05 21:04:22 UTC (rev 60307)
@@ -126,6 +126,11 @@
     * The snapshot manager we are using.
     */
    private SnapshotManager snapshotManager_;
+   
+   /**
+    * Whether we are doing trace level logging
+    */
+   private boolean trace;
 
    //  ----------------------------------------------------------  Constructors
 
@@ -626,7 +631,7 @@
 
          synchronized (session)
          {
-            if (log_.isTraceEnabled())
+            if (trace)
             {
                log_.trace("check to see if needs to store and replicate " +
                           "session with id " + session.getIdInternal());
@@ -772,7 +777,7 @@
       if (session == null 
             && !SessionReplicationContext.isSessionBoundAndExpired(realId, snapshotManager_))
       {
-         if (log_.isTraceEnabled())
+         if (trace)
             log_.trace("Checking for session " + realId + " in the distributed cache");
          
          session = loadSession(realId);
@@ -785,7 +790,7 @@
       }
       else if (session != null && session.isOutdated())
       {
-         if (log_.isTraceEnabled())
+         if (trace)
             log_.trace("Updating session " + realId + " from the distributed cache");
          
          // Need to update it from the cache
@@ -1170,6 +1175,18 @@
    }
 
    /**
+    * Overrides the superclass version to add a check as to whether
+    * we should do trace level logging.
+    */
+   @Override
+   public void backgroundProcess()
+   {
+      trace = log_.isTraceEnabled();
+      
+      super.backgroundProcess();
+   }
+
+   /**
     * Goes through all sessions and look if they have expired.
     * Note this overrides the method in JBossManager.
     */
@@ -1281,7 +1298,7 @@
             {
                session.removeAttributeInternal(attrKey, localCall, localOnly, notify);
             }
-            if (log_.isTraceEnabled())
+            if (trace)
                log_.trace("processRemoteAttributeRemoval: removed attribute " + 
                           attrKey + " from " + realId);
          }
@@ -1302,7 +1319,7 @@
          // from the list of cached sessions we haven't loaded
          if (unloadedSessions_.remove(realId) != null)
          {
-            if (log_.isTraceEnabled())
+            if (trace)
                log_.trace("Removed entry for session " + realId + " from unloaded session map");
          }
       }
@@ -1340,6 +1357,20 @@
          activeCounter_--;
       }
    }
+   
+   public void processLocalPojoModification(String realId)
+   {
+      ClusteredSession session = findLocalSession(realId);
+      if (session != null)
+      {
+         if (trace)
+         {
+            log_.trace("Marking attributes of session " + realId + 
+                       " dirty due to POJO modification");
+         }
+         session.sessionAttributesDirty();
+      }
+   }
 
    /**
     * Gets the session id with any jvmRoute removed.
@@ -1364,7 +1395,7 @@
    {
       Object obj = unloadedSessions_.put(realId, 
             new OwnedSessionUpdate(dataOwner, System.currentTimeMillis()));
-      if (log_.isTraceEnabled())
+      if (trace)
       {
          if (obj == null)
          {




More information about the jboss-cvs-commits mailing list