Struts2 Session Storage Location and Management

I read Struts2 In Action, and it says that an instance is created for each request ActionContext, a ValueStackand Action, therefore, they are thread safe. I was wondering how the structure manages the session, because it cannot be stored in these places where the actual Map is stored, and how is parallel access to this Map controlled by the infrastructure?

+4
source share
1 answer

The http-session is stored in SessionMap, which is one of the other context maps, stored in the context of the action by the dispatcher when serving the request. A session map is a wrapper for an http session object, and operations such as get/ putare synchronized using the http session object monitor. It just synchronizes access to the attributes of the http session, however it provides an implementation Map.

+1
source

Source: https://habr.com/ru/post/1544895/


All Articles