Struts2 Session Storage Location and Management

こ雲淡風輕ζ 提交于 2019-12-21 17:31:52

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/24262422/struts2-session-storage-location-and-management

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!