tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1402021 - /tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
Date Thu, 25 Oct 2012 08:42:20 GMT
Author: kfujino
Date: Thu Oct 25 08:42:20 2012
New Revision: 1402021

URL: http://svn.apache.org/viewvc?rev=1402021&view=rev
Log:
Add support for LAST_ACCESS_AT_START system property to PersistentManager.

Modified:
    tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java

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=1402021&r1=1402020&r2=1402021&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java Thu Oct 25 08:42:20
2012
@@ -901,8 +901,12 @@ public abstract class PersistentManagerB
                 synchronized (session) {
                     if (!session.isValid())
                         continue;
-                    int timeIdle = // Truncate, do not round up
-                        (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                    int timeIdle;
+                    if (StandardSession.LAST_ACCESS_AT_START) {
+                        timeIdle = (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
+                    } else {
+                        timeIdle = (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                    }
                     if (timeIdle > maxIdleSwap && timeIdle > minIdleSwap) {
                         if (session.accessCount != null &&
                                 session.accessCount.get() > 0) {
@@ -952,8 +956,12 @@ public abstract class PersistentManagerB
         for (int i = 0; i < sessions.length && toswap > 0; i++) {
             StandardSession session =  (StandardSession) sessions[i];
             synchronized (session) {
-                int timeIdle = // Truncate, do not round up
-                    (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                int timeIdle;
+                if (StandardSession.LAST_ACCESS_AT_START) {
+                    timeIdle = (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
+                } else {
+                    timeIdle = (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                }
                 if (timeIdle > minIdleSwap) {
                     if (session.accessCount != null &&
                             session.accessCount.get() > 0) {
@@ -996,8 +1004,12 @@ public abstract class PersistentManagerB
                 synchronized (session) {
                     if (!session.isValid())
                         continue;
-                    int timeIdle = // Truncate, do not round up
-                        (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                    int timeIdle;
+                    if (StandardSession.LAST_ACCESS_AT_START) {
+                        timeIdle = (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
+                    } else {
+                        timeIdle = (int) ((timeNow - session.getThisAccessedTime()) / 1000L);
+                    }
                     if (timeIdle > maxIdleBackup) {
                         if (log.isDebugEnabled())
                             log.debug(sm.getString



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


Mime
View raw message