@Override public String getConversationId() { return getVaadinSession().getSession().getId(); }
@Override public String getConversationId() { return getVaadinSession().getSession().getId(); }
/** * Returns whether the given session is active or whether it can be closed. * <p> * A session is active if and only if its {@link VaadinSession#getState()} * returns {@link VaadinSessionState#OPEN} and * {@link #getUidlRequestTimeout(VaadinSession) getUidlRequestTimeout} is * negative or has not yet expired. * * @param session * The session whose status to check * @return true if the session is active, false if it could be closed. */ private boolean isSessionActive(VaadinSession session) { if (session.getState() != VaadinSessionState.OPEN || session.getSession() == null) { return false; } else { long now = System.currentTimeMillis(); int timeout = 1000 * getUidlRequestTimeout(session); return timeout < 0 || now - session.getLastRequestTimestamp() < timeout; } }
if (session.getState() == VaadinSessionState.OPEN) { closeSession(session); if (session.getSession() != null) { getLogger().debug("Closing inactive session {}", session.getSession().getId()); if (session.getSession() != null) { removeSession(session.getSession());
/** * Returns the number of seconds that must pass without a valid UIDL request * being received for the given session before the session is closed, even * though heartbeat requests are received. This is a lower bound; it might * take longer to close an inactive session. * <p> * Returns a negative number if there is no timeout. In this case heartbeat * requests suffice to keep the session alive, but it will still eventually * expire in the regular manner if there are no requests at all (see * {@link WrappedSession#getMaxInactiveInterval()}). * * @return The UIDL request timeout in seconds, or a negative number if * timeout never occurs. * @see DeploymentConfiguration#isCloseIdleSessions() * @see #getHeartbeatTimeout() */ private int getUidlRequestTimeout(VaadinSession session) { return getDeploymentConfiguration().isCloseIdleSessions() ? session.getSession().getMaxInactiveInterval() : -1; }
@Override public String getConversationId() { return getVaadinSession().getSession().getId() + "-UI:" + getUI().getUIId(); }
@Override public String getConversationId() { return getVaadinSession().getSession().getId() + "-UI:" + getUI().getUIId(); }
/** * Closes those UIs in the given session for which {@link #isUIActive} * yields false. */ private void closeInactiveUIs(VaadinSession session) { final String sessionId = session.getSession().getId(); for (final UI ui : session.getUIs()) { if (!isUIActive(ui) && !ui.isClosing()) { ui.accessSynchronously(() -> { getLogger().debug("Closing inactive UI #{} in session {}", ui.getUIId(), sessionId); ui.close(); }); } } }
&& messages.getSessionExpiredCaption() == null && messages.isSessionExpiredNotificationEnabled() && ui.getSession().getSession() != null) { int newTimeoutInterval = ui.getSession().getSession() .getMaxInactiveInterval(); if (repaintAll || (timeoutInterval != newTimeoutInterval)) {