Question

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!

Était-ce utile?

La solution

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

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top