Author: kfujino Date: Thu Oct 25 08:47:08 2012 New Revision: 1402025 URL: http://svn.apache.org/viewvc?rev=1402025&view=rev Log: Add support for LAST_ACCESS_AT_START system property to PersistentManager.
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=1402025&r1=1402024&r2=1402025&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/session/PersistentManagerBase.java Thu Oct 25 08:47:08 2012 @@ -920,8 +920,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) { @@ -971,8 +975,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) { @@ -1015,8 +1023,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 Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1402025&r1=1402024&r2=1402025&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Oct 25 08:47:08 2012 @@ -60,6 +60,10 @@ <bug>53993</bug>: Avoid a possible NPE in the AccessLogValve when the session ID is logged and a session is invalidated. (markt) </fix> + <fix> + Add support for LAST_ACCESS_AT_START system property to + PersistentManager. (kfujino) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org