com.vaadin.server.VaadinSession.close()

Here are the examples of the java api com.vaadin.server.VaadinSession.close() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

14 Source : UiServlet.java
with Apache License 2.0
from opensecuritycontroller

@Deactivate
void stop() {
    // Terminate Vaadin UI Application
    destroy();
    for (VaadinSession vaadinSession : sessions) {
        vaadinSession.close();
        // Redirect all UIs to force the close
        for (UI ui : vaadinSession.getUIs()) {
            ui.access(() -> ui.getPage().setLocation("/"));
        }
    }
}

13 Source : UiListenerDelegate.java
with Apache License 2.0
from opensecuritycontroller

// Close vaadin sessions replacedociated to the given loginName,
// or all sessions if loginName is null.
private void closeUserVaadinSessions(String loginName) {
    // CopyOnWriteArrayList is thread safe for iteration under update
    for (HttpSession session : this.sessions) {
        for (VaadinSession vaadinSession : VaadinSession.getAllSessions(session)) {
            Object userName = vaadinSession.getAttribute("user");
            if (loginName == null || loginName.equals(userName)) {
                vaadinSession.close();
                // Redirect all UIs to force the close
                for (UI ui : vaadinSession.getUIs()) {
                    ui.access(() -> {
                        ui.getPage().setLocation("/");
                    });
                }
            }
        }
    }
}