is there any other way to add actions for destroying specific session in other way than by implementing SessionDestroyListener. I want to fire it in other places in code. For example i want to delete some data from static list that are assigned for session that will be destroyed but left other elements in this list that are assigned for still living sessions. I tried to add something like this:
ui.getSession().getService().addSessionDestroyListener( evt -> {
list.remove(this);
});
But then this listener is fired as excpected when some session is destroyed but then it is fired also for still living sessions. So after one session is detroyed then element for all sessions are removed. In debugging i discoverd that each Session have this same Service.
I'm using Vaadin 14.8.14.
I want to fire destroy listener only for session where it was added.