public class CachingSessionDataStore extends ContainerLifeCycle implements SessionDataStore
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Modifier and Type | Field and Description |
---|---|
protected SessionDataMap |
_cache
The fronting cache
|
protected SessionDataStore |
_store
The actual store for the session data
|
Constructor and Description |
---|
CachingSessionDataStore(SessionDataMap cache,
SessionDataStore store) |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(String id)
Delete session data
|
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)
Test if data exists for a given session id.
|
Set<String> |
getExpired(Set<String> candidates)
Called periodically, this method should search the data store
for sessions that have been expired for a 'reasonable' amount
of time.
|
SessionDataMap |
getSessionDataMap() |
SessionDataStore |
getSessionStore() |
void |
initialize(SessionContext context)
Initialize this data map for the
given context.
|
boolean |
isPassivating()
True if this type of datastore will passivate session objects
|
SessionData |
load(String id)
Read in session data.
|
SessionData |
newSessionData(String id,
long created,
long accessed,
long lastAccessed,
long maxInactiveMs)
Create a new SessionData
|
void |
store(String id,
SessionData data)
Store the session data.
|
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, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
protected SessionDataStore _store
protected SessionDataMap _cache
public CachingSessionDataStore(SessionDataMap cache, SessionDataStore store)
cache
- store
- public SessionDataStore getSessionStore()
public SessionDataMap getSessionDataMap()
public SessionData load(String id) throws Exception
SessionDataMap
load
in interface SessionDataMap
id
- identity of session to loadException
- if unable to load session dataSessionDataMap.load(java.lang.String)
public boolean delete(String id) throws Exception
SessionDataMap
delete
in interface SessionDataMap
id
- identity of session to deleteException
- if unable to delete session dataSessionDataMap.delete(java.lang.String)
public Set<String> getExpired(Set<String> candidates)
SessionDataStore
getExpired
in interface SessionDataStore
candidates
- if provided, these are keys of sessions that
the SessionDataStore thinks has expired and should be verified by the
SessionDataStoreSessionDataStore.getExpired(Set)
public void store(String id, SessionData data) throws Exception
SessionDataMap
store
in interface SessionDataMap
id
- identity of session to storedata
- info of session to storeException
- if unable to write session dataSessionDataMap.store(java.lang.String, org.eclipse.jetty.server.session.SessionData)
protected void doStart() throws Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
Exception
protected void doStop() throws Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
Exception
public boolean isPassivating()
SessionDataStore
isPassivating
in interface SessionDataStore
SessionDataStore.isPassivating()
public boolean exists(String id) throws Exception
SessionDataStore
exists
in interface SessionDataStore
id
- Identity of session whose existance should be checkedException
- if problem checking existance with persistence layerSessionDataStore.exists(java.lang.String)
public void initialize(SessionContext context) throws Exception
SessionDataMap
initialize
in interface SessionDataMap
context
- context associatedException
SessionDataMap.initialize(org.eclipse.jetty.server.session.SessionContext)
public SessionData newSessionData(String id, long created, long accessed, long lastAccessed, long maxInactiveMs)
SessionDataStore
newSessionData
in interface SessionDataStore
id
- the idcreated
- the timestamp when createdaccessed
- the timestamp when accessedlastAccessed
- the timestamp when last accessedmaxInactiveMs
- the max inactive time in millisecondsSessionDataStore.newSessionData(java.lang.String, long, long, long, long)
Copyright © 1995–2017 Webtide. All rights reserved.