What about
session.invalidate();
The invalid session object method is used to drop the session and releases any objects stored as attributes. This method helps reduce memory overhead and achieve improved performance. It is always good practice to explicitly delete or terminate sessions using session.invalidate ().
or
session.removeAttribute(String)
The removeAttribute method of the session object is used to remove the attribute and value from the session.
rahul source share