简体   繁体   English

Tomcat Sesison 调度程序存在

[英]Tomcat Sesison Scheduler Existence

Tomcat (as a servlet container) is able to manage sessions. Tomcat(作为 servlet 容器)能够管理会话。 When the session expires, tomcat have to invalidate it.当 session 到期时,tomcat 必须使其失效。 As far as I'm concerned tomcat has a scheduler, which checks sessions expiration (am I right? I've tried to write a listener which implemented the HttpSessionListener (expiration period == 1 minute), and it's sessionDestroyed method was notified after a minute but I'm not sure what session was invalidated).就我而言,tomcat 有一个调度程序,它检查会话过期(我说的对吗?我尝试编写一个实现 HttpSessionListener(过期时间 == 1 分钟)的侦听器,并且它的 sessionDestroyed 方法在分钟,但我不确定 session 是无效的)。

The question is, what is the scheduler's check period?问题是,调度器的检查周期是多少?

Short answer: by default checks are made every 60 seconds简短回答:默认情况下每 60 秒进行一次检查

Long answer: The checks are made by a background processing thread.长答案:检查是由后台处理线程进行的。 Each container (Engine, Host or Context) may have its own background processing thread.每个容器(引擎、主机或上下文)都可能有自己的后台处理线程。 If a container does not have a background processing thread, it uses the background processing thread from its parent.如果容器没有后台处理线程,它会使用其父容器的后台处理线程。 Engines have a background processing thread by default that checks every 10s.默认情况下,引擎有一个后台处理线程,每 10 秒检查一次。 Hosts and Contexts do not have background processing threads by default.默认情况下,主机和上下文没有后台处理线程。 Additionally, session managers only run the session expiration code every processExpiresFrequency executions of the background processing thread.此外,session 管理器仅在后台处理线程的每个 processExpiresFrequency 执行时运行 session 过期代码。 The default value for this is 6 so session expiration is executed every 6*10s = 60s by default.默认值为 6,因此 session 过期默认每 6*10s = 60s 执行一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM