public abstract class AbstractSessionCache extends ContainerLifeCycle implements SessionCache
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractSessionCache.PlaceHolderSession
PlaceHolder
|
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
protected SessionContext |
_context
Information about the context to which this SessionCache pertains
|
protected int |
_evictionPolicy
When, if ever, to evict sessions: never; only when the last request for them finishes; after inactivity time (expressed as secs)
|
protected SessionHandler |
_handler
The SessionHandler related to this SessionCache
|
protected boolean |
_removeUnloadableSessions |
protected boolean |
_saveOnCreate
If true, as soon as a new session is created, it will be persisted to the SessionDataStore
|
protected boolean |
_saveOnInactiveEviction
If true, a session that will be evicted from the cache because it has been
inactive too long will be saved before being evicted.
|
protected SessionDataStore |
_sessionDataStore
The authoritative source of session data
|
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPINGEVICT_ON_INACTIVITY, EVICT_ON_SESSION_EXIT, NEVER_EVICT| Constructor and Description |
|---|
AbstractSessionCache(SessionHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
checkExpiration(Set<String> candidates) |
void |
checkInactiveSession(Session session)
Check a session for being inactive and
thus being able to be evicted, if eviction
is enabled.
|
boolean |
contains(String id)
Check to see if this cache contains an entry for the session
corresponding to the session id.
|
Session |
delete(String id)
Remove a session object from this store and from any backing store.
|
abstract Session |
doDelete(String id)
Remove the session with this identity from the store
|
abstract Session |
doGet(String id)
Get the session matching the key
|
abstract Session |
doPutIfAbsent(String id,
Session session)
Put the session into the map if it wasn't already there
|
abstract boolean |
doReplace(String id,
Session oldValue,
Session newValue)
Replace the mapping from id to oldValue with newValue
|
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
boolean |
exists(String id)
Check to see if a session corresponding to the id exists.
|
Session |
get(String id)
Get a session object.
|
int |
getEvictionPolicy() |
SessionDataStore |
getSessionDataStore() |
SessionHandler |
getSessionHandler() |
void |
initialize(SessionContext context) |
boolean |
isRemoveUnloadableSessions() |
boolean |
isSaveOnCreate() |
boolean |
isSaveOnInactiveEviction()
Whether we should save a session that has been inactive before
we boot it from the cache.
|
abstract Session |
newSession(javax.servlet.http.HttpServletRequest request,
SessionData data)
Create a new Session for a request.
|
Session |
newSession(javax.servlet.http.HttpServletRequest request,
String id,
long time,
long maxInactiveMs) |
abstract Session |
newSession(SessionData data)
Create a new Session object from pre-existing session data
|
void |
put(String id,
Session session)
Put the Session object back into the session store.
|
Session |
renewSessionId(String oldId,
String newId) |
void |
setEvictionPolicy(int evictionTimeout)
-1 means we never evict inactive sessions.
|
void |
setRemoveUnloadableSessions(boolean removeUnloadableSessions)
If a session's data cannot be loaded from the store without error, remove
it from the persistent store.
|
void |
setSaveOnCreate(boolean saveOnCreate) |
void |
setSaveOnInactiveEviction(boolean saveOnEvict) |
void |
setSessionDataStore(SessionDataStore sessionStore) |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshutdownaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopprotected SessionDataStore _sessionDataStore
protected final SessionHandler _handler
protected SessionContext _context
protected int _evictionPolicy
protected boolean _saveOnCreate
protected boolean _saveOnInactiveEviction
protected boolean _removeUnloadableSessions
public AbstractSessionCache(SessionHandler handler)
public abstract Session newSession(SessionData data)
newSession in interface SessionCachedata - the session datapublic abstract Session newSession(javax.servlet.http.HttpServletRequest request, SessionData data)
request - the requestdata - the session datapublic abstract Session doGet(String id)
id - session idpublic abstract Session doPutIfAbsent(String id, Session session)
id - the identity of the sessionsession - the session objectpublic abstract boolean doReplace(String id, Session oldValue, Session newValue)
id - the idoldValue - the old valuenewValue - the new valuepublic abstract Session doDelete(String id)
id - the idpublic SessionHandler getSessionHandler()
getSessionHandler in interface SessionCachepublic void initialize(SessionContext context)
initialize in interface SessionCacheSessionCache.initialize(org.eclipse.jetty.server.session.SessionContext)protected void doStart()
throws Exception
ContainerLifeCycledoStart in class ContainerLifeCycleExceptionAbstractLifeCycle.doStart()protected void doStop()
throws Exception
ContainerLifeCycledoStop in class ContainerLifeCycleExceptionAbstractLifeCycle.doStop()public SessionDataStore getSessionDataStore()
getSessionDataStore in interface SessionCachepublic void setSessionDataStore(SessionDataStore sessionStore)
setSessionDataStore in interface SessionCacheSessionCache.setSessionDataStore(org.eclipse.jetty.server.session.SessionDataStore)public int getEvictionPolicy()
getEvictionPolicy in interface SessionCacheSessionCache.getEvictionPolicy()public void setEvictionPolicy(int evictionTimeout)
setEvictionPolicy in interface SessionCacheSessionCache.setEvictionPolicy(int)public boolean isSaveOnCreate()
isSaveOnCreate in interface SessionCachepublic void setSaveOnCreate(boolean saveOnCreate)
setSaveOnCreate in interface SessionCachepublic boolean isRemoveUnloadableSessions()
isRemoveUnloadableSessions in interface SessionCachepublic void setRemoveUnloadableSessions(boolean removeUnloadableSessions)
setRemoveUnloadableSessions in interface SessionCacheremoveUnloadableSessions - public Session get(String id) throws Exception
get in interface SessionCacheExceptionSessionCache.get(java.lang.String)public void put(String id, Session session) throws Exception
put in interface SessionCacheExceptionSessionCache.put(java.lang.String, org.eclipse.jetty.server.session.Session)public boolean exists(String id) throws Exception
exists in interface SessionCacheException - the ExceptionSessionCache.exists(java.lang.String)public boolean contains(String id) throws Exception
contains in interface SessionCacheExceptionSessionCache.contains(java.lang.String)public Session delete(String id) throws Exception
delete in interface SessionCacheExceptionSessionCache.delete(java.lang.String)public Set<String> checkExpiration(Set<String> candidates)
checkExpiration in interface SessionCacheSessionCache.checkExpiration(Set)public void checkInactiveSession(Session session)
checkInactiveSession in interface SessionCachesession - session to checkpublic Session renewSessionId(String oldId, String newId) throws Exception
renewSessionId in interface SessionCacheExceptionSessionCache.renewSessionId(java.lang.String, java.lang.String)public void setSaveOnInactiveEviction(boolean saveOnEvict)
setSaveOnInactiveEviction in interface SessionCacheSessionCache.setSaveOnInactiveEviction(boolean)public boolean isSaveOnInactiveEviction()
isSaveOnInactiveEviction in interface SessionCachepublic Session newSession(javax.servlet.http.HttpServletRequest request, String id, long time, long maxInactiveMs)
newSession in interface SessionCacheSessionCache.newSession(javax.servlet.http.HttpServletRequest, java.lang.String, long, long)Copyright © 1995–2016 Mort Bay Consulting. All rights reserved.