Component
, SessionDataStore
public class FileSessionDataStore extends AbstractSessionDataStore
gracePeriodSec, lastExpiryCheckTime, savePeriodSec
Constructor | Description |
---|---|
FileSessionDataStore() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
delete(java.lang.String id) |
Delete session data.
|
protected void |
doDestroy() |
|
java.util.Set<java.lang.String> |
doGetExpired(java.util.Set<java.lang.String> candidates) |
Check to see which sessions have expired.
|
protected void |
doInitialize() |
|
void |
doStore(java.lang.String id,
SessionData data,
long lastSaveTime) |
Store the session data persistently.
|
boolean |
exists(java.lang.String id) |
Test if data exists for a given session id.
|
java.io.File |
getStoreDir() |
|
boolean |
isDeleteUnrestorableFiles() |
|
boolean |
isPassivating() |
True if this type of datastore will passivate session objects.
|
SessionData |
load(java.lang.String id) |
Read in session data.
|
void |
setDeleteUnrestorableFiles(boolean deleteUnrestorableFiles) |
|
void |
setStoreDir(java.io.File storeDir) |
|
void |
sweepDisk() |
Check all session files that do not belong to this context and
remove any that expired long ago (ie at least 5 gracePeriods ago).
|
void |
sweepFile(long now,
java.nio.file.Path p) |
Check to see if the expiry on the file is very old, and
delete the file if so.
|
java.lang.String |
toString() |
destroy, getComponentName, initialize, isAvailable, isDestroyed, isInitialized
checkInitialized, getExpired, getGracePeriodSec, getSavePeriodSec, newSessionData, setGracePeriodSec, setSavePeriodSec, store
destroy, getComponentName, initialize, isAvailable, isDestroyed, isInitialized
public java.io.File getStoreDir()
public void setStoreDir(java.io.File storeDir)
public boolean isDeleteUnrestorableFiles()
public void setDeleteUnrestorableFiles(boolean deleteUnrestorableFiles)
public boolean delete(java.lang.String id) throws java.lang.Exception
SessionDataStore
id
- identity of session to deletejava.lang.Exception
- if unable to delete session datapublic java.util.Set<java.lang.String> doGetExpired(java.util.Set<java.lang.String> candidates)
doGetExpired
in class AbstractSessionDataStore
candidates
- the set of session ids that the SessionCache believes
have expiredpublic SessionData load(java.lang.String id) throws java.lang.Exception
SessionDataStore
id
- identity of session to loadjava.lang.Exception
- if unable to load session datapublic void doStore(java.lang.String id, SessionData data, long lastSaveTime) throws java.lang.Exception
AbstractSessionDataStore
doStore
in class AbstractSessionDataStore
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 boolean isPassivating()
SessionDataStore
public boolean exists(java.lang.String id) throws java.lang.Exception
SessionDataStore
id
- Identity of session whose existence should be checkedjava.lang.Exception
- if there is a problem checking the existence with persistence layerpublic void sweepDisk()
public void sweepFile(long now, java.nio.file.Path p) throws java.lang.Exception
now
- the time now in msecp
- the file to checkjava.lang.Exception
- indicating error in sweepprotected void doInitialize() throws java.lang.Exception
doInitialize
in class AbstractSessionDataStore
java.lang.Exception
protected void doDestroy()
doDestroy
in class AbstractSessionDataStore
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2008–2018 The Aspectran Project. All rights reserved.