Author: markt
Date: Sat Jun 13 19:05:56 2009
New Revision: 784453

URL: http://svn.apache.org/viewvc?rev=784453&view=rev
Log:
Enhancements to fix for 
https://issues.apache.org/bugzilla/show_bug.cgi?id=43343 based on kkolinko's 
review

Modified:
    tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
    tomcat/trunk/webapps/docs/config/manager.xml

Modified: 
tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=784453&r1=784452&r2=784453&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java 
Sat Jun 13 19:05:56 2009
@@ -1054,12 +1054,11 @@
                     int timeIdle = // Truncate, do not round up
                         (int) ((timeNow - session.getThisAccessedTime()) / 
1000L);
                     if (timeIdle > maxIdleSwap && timeIdle > minIdleSwap) {
-                        if (sessions[i] instanceof StandardSession) {
-                            if (((StandardSession) 
sessions[i]).accessCount.get() > 0) {
-                                // Session is currently being accessed - skip 
it
-                                continue;
-                            }
-                        }                       
+                        if (session.accessCount != null &&
+                                session.accessCount.get() > 0) {
+                            // Session is currently being accessed - skip it
+                            continue;
+                        }
                         if (log.isDebugEnabled())
                             log.debug(sm.getString
                                 ("persistentManager.swapMaxIdle",
@@ -1100,22 +1099,22 @@
         long timeNow = System.currentTimeMillis();
 
         for (int i = 0; i < sessions.length && toswap > 0; i++) {
-            synchronized (sessions[i]) {
+            StandardSession session =  (StandardSession) sessions[i];
+            synchronized (session) {
                 int timeIdle = // Truncate, do not round up
-                    (int) ((timeNow - sessions[i].getThisAccessedTime()) / 
1000L);
+                    (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
                 if (timeIdle > minIdleSwap) {
-                    if (sessions[i] instanceof StandardSession) {
-                        if (((StandardSession) sessions[i]).accessCount.get() 
> 0) {
-                            // Session is currently being accessed - skip it
-                            continue;
-                        }
+                    if (session.accessCount != null &&
+                            session.accessCount.get() > 0) {
+                        // Session is currently being accessed - skip it
+                        continue;
                     }
                     if(log.isDebugEnabled())
                         log.debug(sm.getString
                             ("persistentManager.swapTooManyActive",
-                             sessions[i].getIdInternal(), new 
Integer(timeIdle)));
+                             session.getIdInternal(), new Integer(timeIdle)));
                     try {
-                        swapOut(sessions[i]);
+                        swapOut(session);
                     } catch (IOException e) {
                         // This is logged in writeSession()
                     }

Modified: tomcat/trunk/webapps/docs/config/manager.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/manager.xml?rev=784453&r1=784452&r2=784453&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/manager.xml (original)
+++ tomcat/trunk/webapps/docs/config/manager.xml Sat Jun 13 19:05:56 2009
@@ -165,6 +165,12 @@
     has not been thoroughly tested, and should be considered experimental!
     </strong></em></p>
 
+    <p><strong>NOTE:</strong> You must set either the
+    <code>org.apache.catalina.session.StandardSession.ACTIVITY_CHECK</code> or
+    <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code>
+    <a href="systemprops.html">system properties</a> to <code>true</code> for
+    the persistent manager to work correctly.</p>
+    
     <p>The persistent implementation of <strong>Manager</strong> is
     <strong>org.apache.catalina.session.PersistentManager</strong>.  In
     addition to the usual operations of creating and deleting sessions, a



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to