Hi all,
I’m struggling with catching the detach events for idle sessions to clean some cache. I’m using V7.0.4
I followed the guidance in the BOV at https://vaadin.com/book/vaadin7/-/page/application.lifecycle.html
and the wiki at https://vaadin.com/wiki/-/wiki/Main/Cleaning+up+resources+in+an+UI
The web.xml configuration parameters ‘heartbeatInterval’ and closeIdleSessions (true) are likely set correct:
<servlet>
<servlet-name>UIApplication</servlet-name>
<servlet-class>...
<init-param>
<param-name>heartbeatInterval</param-name>
<param-value>20</param-value>
</init-param>
<init-param>
<param-name>closeIdleSessions</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
which shows a request to the session parameters in the UI: getSession().getConfiguration().getHeartbeatInterval() (=20sec)/ isCloseIdleSessions() (=true).
I call my application in Firefox and follow the heartbeats with the httpFox- tracer add-on. Perfect !
I change the URL to ‘about:blank’ and the heartbeats vanish ! Perfect !
I wait 3 heatbeat intervalls and … nothing happens.
My app is as simple as can be:
...
public class SimpleiUI extends UI implements DetachListener{
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
addDetachListener(this);
System.out.println("UI-IdleTimeout: " + getSession().getConfiguration().getHeartbeatInterval() + ",IdleClean:"+ getSession().getConfiguration().isCloseIdleSessions() );
}
@Override
public void detach(DetachEvent event) {
System.out.println ("Detach listener");
}
}
I’m lost, where is my misunderstanding ?
Thanks for any help !
Gerd