Reputation: 561
Basically what I'd like to do is to instruct my application to write the session data to a MySQL database before timing out and deleting it from memory.
For example, say I have a User bean that contains the user's name, and I'll be changing that name a lot so storing it to the database every time a change occurs isn't an option, I want to be able to make the changes on RAM. The, when time comes and the user goes inactive, just before unloading it all I want to save it to my database.
Upvotes: 0
Views: 718
Reputation: 5919
You need to implement a listener, HttpSessionListener
to be specific. it will give you a callback method called sessionDestroyed(HttpSessionEvent hse)
, which you can use to implement your session data saving logic.
Upvotes: 1