/** * {@code HazelcastHttpSession instance} creation is split off to a separate method to allow subclasses to return a * customized / extended version of {@code HazelcastHttpSession}. * * @param id the session id * @param originalSession the original session * @return a new HazelcastHttpSession instance */ protected HazelcastHttpSession createHazelcastHttpSession(String id, HttpSession originalSession) { return new HazelcastHttpSession(this, id, originalSession, config.isDeferredWrite(), config.isStickySession(), config.getTransientAttributes()); }
private HazelcastHttpSession readFromCookie() { String existingHazelcastSessionId = findHazelcastSessionIdFromRequest(); if (existingHazelcastSessionId != null) { hazelcastSession = getSessionWithId(existingHazelcastSessionId); if (hazelcastSession != null && !hazelcastSession.isStickySession()) { hazelcastSession.updateReloadFlag(); return hazelcastSession; } } return null; }
void destroy(boolean invalidate) { valid = false; webFilter.getClusteredSessionService().deleteSession(id, invalidate); }
@Override public HazelcastHttpSession getSession(final boolean create) { hazelcastSession = readSessionFromLocal(); String hazelcastSessionId = findHazelcastSessionIdFromRequest(); if (hazelcastSession == null && !res.isCommitted() && (create || hazelcastSessionId != null)) { hazelcastSession = createNewSession(HazelcastRequestWrapper.this, create, hazelcastSessionId); } return hazelcastSession; }
@Override public final void destroy() { sessions.clear(); originalSessions.clear(); if (config.isShutdownOnDestroy()) { clusteredSessionService.destroy(); } }
public class NewOrderSessionListener implements EntryRemovedListener<String, SessionState> { @Override public void entryRemoved(EntryEvent<String, SessionState> event) { SessionState state = event.getOldValue(); Map<String, Data> map = state.getAttributes(); Data orderData = map.get("order"); if (orderData != null) { // Backup all data processed by order }
private HazelcastHttpSession getSessionWithId(final String sessionId) { HazelcastHttpSession session = sessions.get(sessionId); if (session != null && !session.isValid()) { destroySession(session, true); session = null; } return session; }
private boolean sessionExistsInTheCluster(String hazelcastSessionId) { try { return hazelcastSessionId != null && clusteredSessionService.containsSession(hazelcastSessionId); } catch (Exception ignored) { return false; } }
public HazelcastHttpSession(WebFilter webFilter, final String sessionId, final HttpSession originalSession, final boolean deferredWrite, final boolean stickySession, final Set<String> transientAttributes) { this.webFilter = webFilter; this.id = sessionId; this.originalSession = originalSession; this.deferredWrite = deferredWrite; this.stickySession = stickySession; this.transientAttributes = transientAttributes; buildLocalCache(); }
private static URL validateAndGetConfigUrl(ServletContext ctx, boolean useClient, String configLocation, String clientConfigLocation) { if (!useClient && configLocation != null) { return getConfigUrl(ctx, configLocation); } else if (useClient && clientConfigLocation != null) { return getConfigUrl(ctx, clientConfigLocation); } else { return null; } }
/** * Delete attribute. * * @param sessionId the session id * @param attributeName the attribute name * @throws Exception the exception */ void deleteAttribute(String sessionId, String attributeName) throws Exception { setAttribute(sessionId, attributeName, null); }
@Override public void destroy() { if (delegate != null) delegate.destroy(); } }
/** * {@code HazelcastHttpSession instance} creation is split off to a separate method to allow subclasses to return a * customized / extended version of {@code HazelcastHttpSession}. * * @param id the session id * @param originalSession the original session * @return a new HazelcastHttpSession instance */ protected HazelcastHttpSession createHazelcastHttpSession(String id, HttpSession originalSession) { return new HazelcastHttpSession(this, id, originalSession, config.isDeferredWrite(), config.isStickySession(), config.getTransientAttributes()); }
private HazelcastHttpSession readFromCookie() { String existingHazelcastSessionId = findHazelcastSessionIdFromRequest(); if (existingHazelcastSessionId != null) { hazelcastSession = getSessionWithId(existingHazelcastSessionId); if (hazelcastSession != null && !hazelcastSession.isStickySession()) { hazelcastSession.updateReloadFlag(); return hazelcastSession; } } return null; }
@Override public HazelcastHttpSession getSession(final boolean create) { hazelcastSession = readSessionFromLocal(); String hazelcastSessionId = findHazelcastSessionIdFromRequest(); if (hazelcastSession == null && !res.isCommitted() && (create || hazelcastSessionId != null)) { hazelcastSession = createNewSession(HazelcastRequestWrapper.this, create, hazelcastSessionId); } return hazelcastSession; }
void destroy(boolean invalidate) { valid = false; webFilter.getClusteredSessionService().deleteSession(id, invalidate); }
@Override public final void destroy() { sessions.clear(); originalSessions.clear(); if (config.isShutdownOnDestroy()) { clusteredSessionService.destroy(); } }
private boolean sessionExistsInTheCluster(String hazelcastSessionId) { try { return hazelcastSessionId != null && clusteredSessionService.containsSession(hazelcastSessionId); } catch (Exception ignored) { return false; } }
public HazelcastHttpSession(WebFilter webFilter, final String sessionId, final HttpSession originalSession, final boolean deferredWrite, final boolean stickySession, final Set<String> transientAttributes) { this.webFilter = webFilter; this.id = sessionId; this.originalSession = originalSession; this.deferredWrite = deferredWrite; this.stickySession = stickySession; this.transientAttributes = transientAttributes; buildLocalCache(); }
private static URL validateAndGetConfigUrl(ServletContext ctx, boolean useClient, String configLocation, String clientConfigLocation) { if (!useClient && configLocation != null) { return getConfigUrl(ctx, configLocation); } else if (useClient && clientConfigLocation != null) { return getConfigUrl(ctx, clientConfigLocation); } else { return null; } }