Author: markt Date: Sat Dec 31 18:28:31 2011 New Revision: 1226158 URL: http://svn.apache.org/viewvc?rev=1226158&view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=52405 Servlet 3.0 Rev A updates Item 3 of 20 maxActiveInterval <= 0 means never expire - previously 0 meant expire immediately
Modified: tomcat/trunk/java/javax/servlet/http/HttpSession.java tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Modified: tomcat/trunk/java/javax/servlet/http/HttpSession.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpSession.java?rev=1226158&r1=1226157&r2=1226158&view=diff ============================================================================== --- tomcat/trunk/java/javax/servlet/http/HttpSession.java (original) +++ tomcat/trunk/java/javax/servlet/http/HttpSession.java Sat Dec 31 18:28:31 2011 @@ -116,8 +116,8 @@ public interface HttpSession { /** * Specifies the time, in seconds, between client requests before the - * servlet container will invalidate this session. A negative time indicates - * the session should never timeout. + * servlet container will invalidate this session. A zero or negative time + * indicates that the session should never timeout. * * @param interval * An integer specifying the number of seconds @@ -129,7 +129,7 @@ public interface HttpSession { * will keep this session open between client accesses. After this interval, * the servlet container will invalidate the session. The maximum time * interval can be set with the <code>setMaxInactiveInterval</code> method. - * A negative time indicates the session should never timeout. + * A zero or negative time indicates that the session should never timeout. * * @return an integer specifying the number of seconds this session remains * open between client requests Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=1226158&r1=1226157&r2=1226158&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original) +++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Sat Dec 31 18:28:31 2011 @@ -276,16 +276,12 @@ public class DeltaSession extends Standa public void setMaxInactiveInterval(int interval, boolean addDeltaRequest) { super.maxInactiveInterval = interval; - if (isValid && interval == 0) { - expire(); - } else { - if (addDeltaRequest && (deltaRequest != null)) { - try { - lock(); - deltaRequest.setMaxInactiveInterval(interval); - }finally{ - unlock(); - } + if (addDeltaRequest && (deltaRequest != null)) { + try { + lock(); + deltaRequest.setMaxInactiveInterval(interval); + }finally{ + unlock(); } } } @@ -374,7 +370,7 @@ public class DeltaSession extends Standa if (ACTIVITY_CHECK && accessCount.get() > 0) { return true; } - if (maxInactiveInterval >= 0) { + if (maxInactiveInterval > 0) { long timeNow = System.currentTimeMillis(); int timeIdle; if (LAST_ACCESS_AT_START) { Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=1226158&r1=1226157&r2=1226158&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java (original) +++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Sat Dec 31 18:28:31 2011 @@ -533,19 +533,14 @@ public class StandardSession implements /** * Set the maximum time interval, in seconds, between client requests - * before the servlet container will invalidate the session. A negative - * time indicates that the session should never time out. + * before the servlet container will invalidate the session. A zero or + * negative time indicates that the session should never time out. * * @param interval The new maximum interval */ @Override public void setMaxInactiveInterval(int interval) { - this.maxInactiveInterval = interval; - if (isValid && interval == 0) { - expire(); - } - } @@ -639,7 +634,7 @@ public class StandardSession implements return true; } - if (maxInactiveInterval >= 0) { + if (maxInactiveInterval > 0) { long timeNow = System.currentTimeMillis(); int timeIdle; if (LAST_ACCESS_AT_START) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org