HttpSession is just an interface specification, so no specific details are defined;
In the specific implementation of HttpSession, thread safety is considered. For example, all session attributes in Tomcat8 are stored in an independent ConcurrentHashMap;
Blindly locking and synchronizing the session will cause performance problems. When to lock the session actually depends on your specific needs.
HttpSession is just an interface specification, so no specific details are defined;
In the specific implementation of HttpSession, thread safety is considered. For example, all session attributes in Tomcat8 are stored in an independent ConcurrentHashMap;
Blindly locking and synchronizing the session will cause performance problems. When to lock the session actually depends on your specific needs.