title: How to call a method before the session object is destroyed?
body: <p>When developing a JSP application it's possible to define a session timeout value, say 30 minutes.</p>
  
  <p>After that timeout, the session object is destroyed. 
  Moreover I can programmatically invalidate a session calling session.invalidate() .</p>
  
  <p>Since I'm saving a complex Java object inside the HTTP session, before invalidate the session or let it expire by the tomcat app server, I need to call a saved object method to release some memory. Of course I can do it programmatically when the user click a logout button.</p>
  
  <p>What I would like to do is intercepting the Tomcat app server when it is going to destroy all expired sessions (30 minutes or custom), so that I can pre-process Java objects saved in the session calling a specific method to release memory.</p>
  
  <p>Is it possible?</p>