Our application requires that we serialize some of the user's session data to the filesystem if their session expires. We would serialize it as is coming in but that would be too expensive due to the nature of our application.
If we can figure out a way to hook some sort of 'onSessionEnd' method we could run the cleanup code then.
You need to setup a HttpSessionListener for your application.
There is a method on the interface called onSessionDestroy that shall be called when the session ends and you can perform serialization right then.
To setup the listener, you add into web.xml:
<listener>
<listener-class>com.example.app.session.MySessionListener</listener-class>
</listener>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With