Component, SessionDataStoreFileSessionDataStorepublic abstract class AbstractSessionDataStore extends AbstractComponent implements SessionDataStore
Created: 2017. 9. 10.
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
gracePeriodSec |
|
protected long |
lastExpiryCheckTime |
|
protected int |
savePeriodSec |
| Constructor | Description |
|---|---|
AbstractSessionDataStore() |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
checkInitialized() |
|
protected void |
doDestroy() |
|
abstract java.util.Set<java.lang.String> |
doGetExpired(java.util.Set<java.lang.String> candidates) |
Implemented by subclasses to resolve which sessions this node
should attempt to expire.
|
protected void |
doInitialize() |
|
abstract void |
doStore(java.lang.String id,
SessionData data,
long lastSaveTime) |
Store the session data persistently.
|
java.util.Set<java.lang.String> |
getExpired(java.util.Set<java.lang.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() |
|
SessionData |
newSessionData(java.lang.String id,
long createdTime,
long accessedTime,
long lastAccessedTime,
long maxInactiveIntervalMS) |
Create a new SessionData.
|
void |
setGracePeriodSec(int sec) |
Sets the interval in secs to prevent too eager session scavenging.
|
void |
setSavePeriodSec(int savePeriodSec) |
The minimum time in seconds between save operations.
|
void |
store(java.lang.String id,
SessionData data) |
Store the session data.
|
destroy, getComponentName, initialize, isAvailable, isDestroyed, isInitializeddestroy, getComponentName, initialize, isAvailable, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdelete, exists, isPassivating, loadprotected int gracePeriodSec
protected long lastExpiryCheckTime
protected int savePeriodSec
public abstract void doStore(java.lang.String id,
SessionData data,
long lastSaveTime)
throws java.lang.Exception
id - identity of session to storedata - info of the sessionlastSaveTime - time of previous save or 0 if never savedjava.lang.Exception - if unable to store datapublic abstract java.util.Set<java.lang.String> doGetExpired(java.util.Set<java.lang.String> candidates)
candidates - the ids of sessions the SessionDataStore thinks has expiredpublic void store(java.lang.String id,
SessionData data)
throws java.lang.Exception
SessionDataStorestore in interface SessionDataStoreid - identity of session to storedata - info of session to storejava.lang.Exception - if unable to write session datapublic java.util.Set<java.lang.String> getExpired(java.util.Set<java.lang.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
SessionDataStorepublic SessionData newSessionData(java.lang.String id, long createdTime, long accessedTime, long lastAccessedTime, long maxInactiveIntervalMS)
SessionDataStorenewSessionData in interface SessionDataStoreid - the idcreatedTime - the timestamp when createdaccessedTime - the timestamp when accessedlastAccessedTime - the timestamp when last accessedmaxInactiveIntervalMS - the max inactive time in millisecondspublic int getGracePeriodSec()
public void setGracePeriodSec(int sec)
sec - interval in secs to prevent too eager session scavengingpublic 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 setprotected void doInitialize()
throws java.lang.Exception
doInitialize in class AbstractComponentjava.lang.Exceptionprotected void doDestroy()
doDestroy in class AbstractComponentprotected void checkInitialized()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionCopyright © 2008–2018 The Aspectran Project. All rights reserved.