Will session.invalidate () remove the attribute set for the session?

If I set the attribute value in the request and then call session.invalidate() , what will happen to the value attributes? Will they still be there?

+7
source share
2 answers

They will still be in memory, but they no longer refer to the HttpSession . That is, they are no longer available to HttpSession .

Once the garbage collector starts up and these objects have no other references by other classes / instances, they will eventually be destroyed and freed.

+7
source

request and sessions are two different things. the attributes set in the request will be available until you complete the request. After execution, all values ​​will be deleted.

Attributes in the session will be present before the session expires or explicitly cause invalidation. Any of them will kill the current session and create a new one at the next request.

+2
source

All Articles