The servlet engine will handle session timeouts. He will determine when the session is no longer valid, and he will call sessionDestroyed . (this can happen some time after the user closes the browser).
Some other points:
Logging
Perhaps you can add some entries to the sessionCreated and sessionDestroyed methods. for every session you create, you must have sessionDestroyed.
Excepion Processing
Perhaps the fact that the material remains blocked is not due to the fact that the session is not destroyed, but, perhaps, due to an error in your sessionDestroyed logic. Do you have sufficient handling / registration of exceptions?
Timing
Do you wait long enough to check for blocked resources? (close all clients and consider the session timeout value configured on the application / server). As mentioned earlier, the server cannot detect the user closing the browser, but he retains his list of http-sessions, and he will destroy them after a timeout.
source share