@ManagedObject public abstract class AbstractSessionDataStore extends ContainerLifeCycle implements SessionDataStore
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
protected SessionContext |
_context |
protected int |
_gracePeriodSec |
protected long |
_lastExpiryCheckTime |
protected int |
_savePeriodSec |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| 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() |
int |
getSavePeriodSec() |
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 |
setSavePeriodSec(int savePeriodSec)
The minimum time in seconds between save operations.
|
void |
store(String id,
SessionData data)
Store the session data.
|
String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, 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, wait, wait, waitexists, isPassivatingdelete, loadaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stopprotected SessionContext _context
protected int _gracePeriodSec
protected long _lastExpiryCheckTime
protected int _savePeriodSec
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
SessionDataMapinitialize in interface SessionDataMapcontext - context associatedExceptionSessionDataMap.initialize(org.eclipse.jetty.server.session.SessionContext)public void store(String id, SessionData data) throws Exception
SessionDataMapstore in interface SessionDataMapid - 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)
SessionDataStoregetExpired in interface SessionDataStorecandidates - 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)
SessionDataStorenewSessionData in interface SessionDataStoreid - 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
IllegalStateExceptionprotected void doStart()
throws Exception
doStart in class ContainerLifeCycleException@ManagedAttribute(value="interval in secs to prevent too eager session scavenging", readonly=true) public int getGracePeriodSec()
public void setGracePeriodSec(int sec)
@ManagedAttribute(value="min secs between saves", readonly=true) public int getSavePeriodSec()
public void setSavePeriodSec(int savePeriodSec)
By default the value is 0, which means we save after the last request exists. A non zero value means that we will skip doing the save if the session isn't dirty if the elapsed time since the session was last saved does not exceed this value.
savePeriodSec - the savePeriodSec to setpublic String toString()
toString in class ObjectObject.toString()Copyright © 1995–2017 Webtide. All rights reserved.