public class HazelcastSessionIdManager
extends org.eclipse.jetty.server.session.AbstractSessionIdManager
A jetty instance can only have one session id manager. HazelcastSessionIdManager is responsible of creating Hazelcast instances (client/server/provided) to keep session data distributed and ensuring the cluster-wide unique session id generation. This manager can use Hazelcast in three different ways
clientOnly If this attribute is set to true, then an hazelcast client instance
is startedJettySessionUtils.createHazelcastClientInstance(String) for details
clientOnly If this attribute is set to false (default behaviour), then a hazelcast
instance is startedJettySessionUtils.createHazelcastFullInstance(String) for details
HazelcastInstance can be provided in construction time
HazelcastSessionIdManager(org.eclipse.jetty.server.Server,
com.hazelcast.core.HazelcastInstance)
cleanUpTimer
which is responsible of
removing expired session data from session map.
| Modifier and Type | Field and Description |
|---|---|
protected org.eclipse.jetty.server.Server |
server |
protected Set<String> |
sessionsIds
the (local) collection of session ids known to this manager
|
| Constructor and Description |
|---|
HazelcastSessionIdManager(org.eclipse.jetty.server.Server server)
Creates a session manager with defaults
|
HazelcastSessionIdManager(org.eclipse.jetty.server.Server server,
boolean clientOnly) |
HazelcastSessionIdManager(org.eclipse.jetty.server.Server server,
boolean clientOnly,
String configLocation) |
HazelcastSessionIdManager(org.eclipse.jetty.server.Server server,
com.hazelcast.core.HazelcastInstance instance) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSession(javax.servlet.http.HttpSession session)
Add session id to known local ids
|
protected void |
cleanUp()
Clean is a process that cleans the Hazelcast cluster of old sessions that are no
longer valid.
|
protected void |
doStart() |
protected void |
doStop() |
String |
getClusterId(String nodeId)
Get the session ID without any worker ID.
|
String |
getConfigLocation() |
String |
getNodeId(String clusterId,
javax.servlet.http.HttpServletRequest request)
Get the session ID with any worker ID.
|
com.hazelcast.core.IMap<String,HazelcastSessionData> |
getSessions() |
boolean |
idInUse(String sessionId)
is the session id known to hazelcast, and is it valid
|
void |
invalidateAll(String sessionId) |
void |
removeSession(javax.servlet.http.HttpSession session)
Remove session from known local ids
|
void |
setCleanUp(boolean cleanUp) |
void |
setCleanUpInvalidAge(long cleanUpInvalidAge) |
void |
setCleanUpPeriod(long cleanUpPeriod) |
void |
setClientOnly(boolean clientOnly) |
void |
setConfigLocation(String configLocation) |
void |
setInstance(com.hazelcast.core.HazelcastInstance instance) |
getRandom, getReseed, getWorkerName, initRandom, newSessionId, setRandom, setReseed, setWorkerNameaddLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic HazelcastSessionIdManager(org.eclipse.jetty.server.Server server)
public HazelcastSessionIdManager(org.eclipse.jetty.server.Server server,
boolean clientOnly)
public HazelcastSessionIdManager(org.eclipse.jetty.server.Server server,
boolean clientOnly,
String configLocation)
public HazelcastSessionIdManager(org.eclipse.jetty.server.Server server,
com.hazelcast.core.HazelcastInstance instance)
public boolean idInUse(String sessionId)
public void addSession(javax.servlet.http.HttpSession session)
public void removeSession(javax.servlet.http.HttpSession session)
session - public void invalidateAll(String sessionId)
public String getNodeId(String clusterId, javax.servlet.http.HttpServletRequest request)
clusterId - request - public String getClusterId(String nodeId)
nodeId - the node idprotected void cleanUp()
protected void doStart()
throws Exception
doStart in class org.eclipse.jetty.server.session.AbstractSessionIdManagerExceptionprotected void doStop()
throws Exception
doStop in class org.eclipse.jetty.server.session.AbstractSessionIdManagerExceptionpublic String getConfigLocation()
public void setConfigLocation(String configLocation)
public void setInstance(com.hazelcast.core.HazelcastInstance instance)
public void setClientOnly(boolean clientOnly)
public com.hazelcast.core.IMap<String,HazelcastSessionData> getSessions()
public void setCleanUp(boolean cleanUp)
public void setCleanUpInvalidAge(long cleanUpInvalidAge)
public void setCleanUpPeriod(long cleanUpPeriod)
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.