会话到期时tomcat会做什么?
它是否将会话对象设置为无效?
它是否取消了对会话对象的所有引用,以便我可能无法通过调用来获取过期的会话对象request.getSession(false)
?
我正在使用 Servlet 2.5 规范。谢谢。
Tomcat (and every other container) will call HttpSession.invalidate()
Invalidates this session then unbinds any objects bound to it.
Afterwards, request.getSession(false)
will return null
.
Related:
There is no internal session garbage collector thread. Session are removed during getSession()
invocations.
If request.getSession()
is invoked and the session is no longer valid (its idle time is greater than maxInactiveInterval
) then internal expire()
method will be called. This method removes session from the Manager
and fires appropriate events on the HttpSessionListener
.
One can manually invalidate the session using its invalidate()
method, which is a wrapper for the expire()
.