Hello,
The close method is actually called within vaadin as part of your event mechanism i.e. when clicking on an exit button etc
What you want is to call your logic when the http session ends via a session listener. When you shut down the application/web server i’m not certain whether the closing of a session will be signaled as part of the servlet container shutdown process (this is part of the application server or servlet container you are using has nothing to do with vaadin, for example for jetty something like this might be required http://docs.codehaus.org/display/JETTY/How+to+gracefully+shutdown).
So a way to implement such logic would be to use a httpsessionlistener which you register in your web.xml
i.e.
public static final String PARAM_DI_CONTAINER = "PARAM_DI_CONTAINER";
....
((WebApplicationContext)getContext()).getSession().setAttribute(PARAM_DI_CONTAINER, diContainer);//if inside your Application class
....
//otherwise if called not inside your Application class then,
((WebApplicationContext)getApplication().getContext()).getSession().setAttribute(PARAM_DI_CONTAINER, diContainer);
.....
then in httpsessionlistener either in sessionCreated or sessionDestroyed you have access to the HttpSessionEvent
which can give you the session