/** * Handles destruction of the session. */ public void fireSessionDestroy() { SessionDestroyEvent event = new SessionDestroyEvent(getService(), this); destroyListeners.stream() .forEach(listener -> listener.sessionDestroy(event)); destroyListeners.clear(); }
/** * Gets the Vaadin service from which the even originates. * * @return the Vaadin service */ public VaadinService getService() { return getSource(); }
private void sessionDestroy(SessionDestroyEvent sessionDestroyEvent) { beanManager.fireEvent(sessionDestroyEvent); if (VaadinSessionScopedContext.guessContextIsUndeployed()) { // Happens on tomcat when it expires sessions upon undeploy. // beanManager.getPassivationCapableBean returns null for passivation id, // so we would get an NPE from AbstractContext.destroyAllActive getLogger().warn("VaadinSessionScoped context does not exist. " + "Maybe application is undeployed." + " Can't destroy VaadinSessionScopedContext."); return; } getLogger().debug("VaadinSessionScopedContext destroy"); VaadinSessionScopedContext.destroy(sessionDestroyEvent.getSession()); }
private void sessionDestroy(SessionDestroyEvent sessionDestroyEvent) { beanManager.fireEvent(sessionDestroyEvent); if (VaadinSessionScopedContext.guessContextIsUndeployed()) { // Happens on tomcat when it expires sessions upon undeploy. // beanManager.getPassivationCapableBean returns null for passivation id, // so we would get an NPE from AbstractContext.destroyAllActive getLogger().warn("VaadinSessionScoped context does not exist. " + "Maybe application is undeployed." + " Can't destroy VaadinSessionScopedContext."); return; } getLogger().debug("VaadinSessionScopedContext destroy"); VaadinSessionScopedContext.destroy(sessionDestroyEvent.getSession()); }
/** * Creates an instance connected to the given servlet and using the given * configuration with provided application {@code context}. * * @param servlet * the servlet which receives requests * @param deploymentConfiguration * the configuration to use * @param context * the Spring application context */ public SpringVaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, ApplicationContext context) { super(servlet, deploymentConfiguration); this.context = context; SessionDestroyListener listener = event -> sessionDestroyed( event.getSession()); Registration registration = addSessionDestroyListener(listener); serviceDestroyRegistration = addServiceDestroyListener( event -> serviceDestroyed(registration)); }
/** * Handles destruction of the session. */ public void fireSessionDestroy() { SessionDestroyEvent event = new SessionDestroyEvent(getService(), this); destroyListeners.stream() .forEach(listener -> listener.sessionDestroy(event)); destroyListeners.clear(); }
/** * Creates an instance connected to the given servlet and using the given * configuration with provided application {@code context}. * * @param servlet * the servlet which receives requests * @param deploymentConfiguration * the configuration to use * @param context * the Spring application context */ public SpringVaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, ApplicationContext context) { super(servlet, deploymentConfiguration); this.context = context; SessionDestroyListener listener = event -> sessionDestroyed( event.getSession()); Registration registration = addSessionDestroyListener(listener); serviceDestroyRegistration = addServiceDestroyListener( event -> serviceDestroyed(registration)); }
}); SessionDestroyEvent event = new SessionDestroyEvent( VaadinService.this, session); for (SessionDestroyListener listener : sessionDestroyListeners) {
@Override public void sessionDestroy(SessionDestroyEvent sessionDestroyEvent) { if (VaadinSessionScopedContext.guessContextIsUndeployed()) { // Happens on tomcat when it expires sessions upon undeploy. // beanManager.getPassivationCapableBean returns null for passivation id, // so we would get an NPE from AbstractContext.destroyAllActive logger().warning("VaadinSessionScoped context does not exist. " + "Maybe application is undeployed." + " Can't destroy VaadinSessionScopedContext."); return; } logger().info("VaadinSessionScopedContext destroy"); VaadinSessionScopedContext.destroy(sessionDestroyEvent.getSession()); } }