public abstract class AbstractSessionDataStore extends AbstractLifeCycle implements SessionDataStore
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
protected SessionContext |
_context |
protected int |
_gracePeriodSec |
protected long |
_lastExpiryCheckTime |
Constructor and Description |
---|
AbstractSessionDataStore() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkStarted() |
abstract Set<String> |
doGetExpired(Set<String> candidates)
Implemented by subclasses to resolve which sessions this node
should attempt to expire.
|
protected void |
doStart() |
abstract void |
doStore(String id,
SessionData data,
long lastSaveTime)
Store the session data persistently.
|
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.
|
int |
getGracePeriodSec() |
void |
initialize(SessionContext context)
Initialize this data map for the
given context.
|
SessionData |
newSessionData(String id,
long created,
long accessed,
long lastAccessed,
long maxInactiveMs)
Create a new SessionData
|
void |
setGracePeriodSec(int sec) |
void |
store(String id,
SessionData data)
Store the session data.
|
addLifeCycleListener, doStop, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exists, isPassivating
delete, load
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
protected SessionContext _context
protected int _gracePeriodSec
protected long _lastExpiryCheckTime
public abstract void doStore(String id, SessionData data, long lastSaveTime) throws Exception
id
- identity of session to storedata
- info of the sessionlastSaveTime
- time of previous save or 0 if never savedException
- if unable to store datapublic abstract Set<String> doGetExpired(Set<String> candidates)
candidates
- the ids of sessions the SessionDataStore thinks has expiredpublic void initialize(SessionContext context) throws Exception
SessionDataMap
initialize
in interface SessionDataMap
context
- context associatedException
SessionDataMap.initialize(org.eclipse.jetty.server.session.SessionContext)
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)
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(java.util.Set)
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)
protected void checkStarted() throws IllegalStateException
IllegalStateException
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
public int getGracePeriodSec()
public void setGracePeriodSec(int sec)
Copyright © 1995–2016 Mort Bay Consulting. All rights reserved.