public class InfinispanSessionIdManager extends AbstractSessionIdManager
("__o.e.j.s.infinispanIdMgr__"+[id], [id])where [id] is the id of the session. If the first session to be added is not immortal (ie it has a timeout on it) then the corresponding session id is entered into infinispan with an idle expiry timeout equivalent to double the session's timeout (the multiplier is configurable). Having one entry per in-use session id means that there is no contention on cache entries (as would be the case if a single entry was kept containing a list of in-use session ids).
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
protected org.infinispan.commons.api.BasicCache<String,Object> |
_cache |
static int |
DEFAULT_IDLE_EXPIRY_MULTIPLE |
static String |
ID_KEY |
_random, _reseed, _weakRandom, _workerAttr, _workerName
Constructor and Description |
---|
InfinispanSessionIdManager(Server server) |
InfinispanSessionIdManager(Server server,
Random random) |
Modifier and Type | Method and Description |
---|---|
void |
addSession(javax.servlet.http.HttpSession session)
Remember a new in-use session id.
|
protected void |
delete(String id)
Remove a session id from the cluster.
|
protected void |
doStart()
Start the id manager.
|
protected void |
doStop()
Stop the id manager
|
protected boolean |
exists(String id)
Ask the cluster if a particular id exists.
|
org.infinispan.commons.api.BasicCache<String,Object> |
getCache()
Get the cache.
|
int |
getIdleExpiryMultiple() |
boolean |
idInUse(String id)
Check to see if the given session id is being
used by a session in any context.
|
protected void |
insert(String id)
Put a session id into the cluster.
|
protected void |
insert(String id,
long idleTimeOutSec)
Put a session id into the cluster with an idle expiry.
|
void |
invalidateAll(String id)
Remove a session id.
|
protected String |
makeKey(String id)
Generate a unique cache key from the session id.
|
void |
removeSession(javax.servlet.http.HttpSession session)
Remove a session id from the list of in-use ids.
|
void |
renewSessionId(String oldClusterId,
String oldNodeId,
javax.servlet.http.HttpServletRequest request)
Change a session id.
|
void |
setCache(org.infinispan.commons.api.BasicCache<String,Object> cache)
Set the cache.
|
void |
setIdleExpiryMultiple(int multiplier) |
void |
touch(String id)
Do any operation to the session id in the cache to
ensure its idle expiry time moves forward
|
getClusterId, getNodeId, getRandom, getReseed, getWorkerName, initRandom, newSessionId, newSessionId, setRandom, setReseed, setWorkerName
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public static final String ID_KEY
public static final int DEFAULT_IDLE_EXPIRY_MULTIPLE
public InfinispanSessionIdManager(Server server)
server
- protected void doStart() throws Exception
doStart
in class AbstractSessionIdManager
Exception
AbstractSessionIdManager.doStart()
protected void doStop() throws Exception
doStop
in class AbstractSessionIdManager
Exception
AbstractSessionIdManager.doStop()
public boolean idInUse(String id)
id
- The session ID without any cluster node extensionSessionIdManager.idInUse(java.lang.String)
public void addSession(javax.servlet.http.HttpSession session)
session
- The sessionSessionIdManager.addSession(javax.servlet.http.HttpSession)
public void setIdleExpiryMultiple(int multiplier)
public int getIdleExpiryMultiple()
public void removeSession(javax.servlet.http.HttpSession session)
session
- the session to removeSessionIdManager.removeSession(javax.servlet.http.HttpSession)
public void invalidateAll(String id)
id
- The session ID without any cluster node extensionSessionIdManager.invalidateAll(java.lang.String)
public void renewSessionId(String oldClusterId, String oldNodeId, javax.servlet.http.HttpServletRequest request)
renewSessionId
in interface SessionIdManager
renewSessionId
in class AbstractSessionIdManager
oldClusterId
- the old cluster idoldNodeId
- the old node idrequest
- the request containing the sessionAbstractSessionIdManager.renewSessionId(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
public org.infinispan.commons.api.BasicCache<String,Object> getCache()
public void setCache(org.infinispan.commons.api.BasicCache<String,Object> cache)
cache
- public void touch(String id)
id
- protected boolean exists(String id)
id
- protected void insert(String id)
id
- protected void insert(String id, long idleTimeOutSec)
id
- protected void delete(String id)
id
- Copyright © 1995-2015 Webtide. All Rights Reserved.