After reading the How do servlets work? Instantiation, sessions, shared variables and multithreading thread, I was wondering if the sessions stored in the JVM are erased, in a application with no time limit for user session (<session-timeout>-1</session-timeout>)? If so, is it by GC?

Thanks!

有帮助吗?

解决方案

It depends on the container, but the sessions have little to do with GC. For example, tomcat keeps active sessions in memory and saves them to disk. Swapping the active sessions in memory out with inactive (or idle) sessions as needed. This way the sessions survive even when the server is restarted.

Check this out for more info: http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html#Introduction

其他提示

See information here: session-config

Default value: -2

Maximum value: Integer.MAX_VALUE ÷ 60

Special values:

-2 = Use the value set by TimeoutSecs in element of weblogic.xml

-1 = Sessions do not timeout. The value set in element of weblogic.xml is ignored.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top