Struts2会话存储位置和管理 [英] Struts2 Session Storage Location and Management

查看:146
本文介绍了Struts2会话存储位置和管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读Struts2 In Action,它为每个请求说明了一个 ActionContext ,一个 ValueStack 和一个 Action 实例已创建,因此它们是线程安全的。我想知道框架如何管理会话,因为它不能存储在这些位置,实际Map存储在哪里,以及框架如何管理对该Map的并发访问?

I was reading Struts2 In Action, and it says for each request an ActionContext, a ValueStack and an Action instance are created, so they are thread safe. I was wondering how does the framework manages session, because it can't be stored in these locations, where does the actual Map gets stored, and how concurrent access to that Map is managed by the framework?

推荐答案

http会话存储在 SessionMap 中,这是其他上下文映射存储在操作中的调度程序在提交请求时的上下文。会话映射是http会话对象的包装器,并且使用http会话对象同步 get / put 等操作监控。它只是同步对http会话属性的访问,但提供 Map 实现。

The http session is stored in the SessionMap which is among the other context maps is stored in the action context by the dispatcher when serving a request. The session map is a wrapper for http session object and operations such as get/put are synchronized using a http session object monitor. It simply synchronizes the access to http session attributes, however providing a Map implementation.

这篇关于Struts2会话存储位置和管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆