简体   繁体   English

Struts2会话存储位置和管理

[英]Struts2 Session Storage Location and Management

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. 我正在阅读Struts2 In Action,它说每个请求都会创建一个ActionContext ,一个ValueStack和一个Action实例,因此它们是线程安全的。 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? 我想知道框架如何管理会话,因为它不能存储在这些位置,实际的Map存储在哪里,以及框架如何管理对该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. http会话存储在SessionMap中, SessionMap是其他上下文映射,在调度请求时由调度程序存储在操作上下文中。 The session map is a wrapper for http session object and operations such as get / put are synchronized using a http session object monitor. 会话映射是http会话对象的包装,并且使用http会话对象监视器同步诸如get / put类的操作。 It simply synchronizes the access to http session attributes, however providing a Map implementation. 它只是同步对http会话属性的访问,但提供了Map实现。

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

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