How to detect a session.destroy() in Vaadin ?

Hi Vaadin guys,

I need to access a method triggered when a session is closing (with a timeout or when we call Application().close())
Is there a way to access this kind of method ?

When I launch my Application, there are severals ressources which can’t be deleted like static variables NDC from log4j or jdbc resources and I want to be sure that it’s destroyed while session is destroyed.

Thx :slight_smile:

why not to put your termination code to your application.close() method ? When session expires, the method will be invoked by Vaadin core, so you can perform your steps there.

Thx for uyour response,

I 've thought about that but if a navigator crashes or something else, we can’t call this method.
I know that session has a timeout, maybe it could be good if the framework could provide a way to access a method launched when a session expires.

That’s how it works, I’m pretty sure… When the session expires, Application.close() will be called.