public abstract class AbstractSessionDataStore extends ContainerLifeCycle implements SessionDataStore
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Modifier and Type | Field and Description |
---|---|
protected SessionContext |
_context |
protected int |
_gracePeriodSec |
protected long |
_lastExpiryCheckTime |
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()
Starts the managed lifecycle beans in the order they were added.
|
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.
|
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, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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
ContainerLifeCycle
doStart
in class ContainerLifeCycle
Exception
public int getGracePeriodSec()
public void setGracePeriodSec(int sec)
public String toString()
toString
in class Object
Object.toString()
Copyright © 1995–2017 Webtide. All rights reserved.