java tomcat 会话管理器的maxIdleSwap属性和maxIdleBackup属性?
巴扎黑
巴扎黑 2017-04-17 12:05:05
[Java讨论组]

书上有一个关于PersistenManager会话管理器的配置

    <Context  reloadable="true" >
  <Manager className="org.apache.catalina.session.PersistentManager" 
    saveOnRestart="true"
    maxActiveSessions="10"
    minIdleSwap="60"
    maxIdleSwap="120"
    maxIdleBackup="180"
    maxInactiveInterval="300">

    <Store className="org.apache.catalina.session.FileStore" directory="mydir" />

  </Manager>

</Context>

其中这两个属性很不理解:
maxIdleSwap="120"
maxIdleSwap为120s, 最大不活动时间为120s时会把会话保存在会话store中,那么在内存中的这个会话就会被销毁.
但是他还设置了maxIdleBackup="180"
maxIdleBackup为180s, 当不活动的时间大于180s时会把会话备份在store中
这个地方我就在想, 如果一个session在120s的时间被保存在store中, 怎么可能不活动时间为180呢?
我想的有什么不对吗?望大家指正

巴扎黑
巴扎黑

全部回复(1)
黄舟

Tomcat 文档:

maxIdleBackup
The time interval (in seconds) since the last access to a session before it is eligible for being persisted to the session store, or -1 to disable this feature. By default, this feature is disabled.

maxIdleSwap
The time interval (in seconds) since the last access to a session before it should be persisted to the session store, and passivated out of the server's memory, or -1 to disable this feature. If this feature is enabled, the time interval specified here should be equal to or longer than the value specified for maxIdleBackup. By default, this feature is disabled.


黑体部分:maxIdleSwap的值应该大于或等于maxIdleBackup

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号