@ManagedObject public class FileSessionDataStore extends AbstractSessionDataStore
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Constructor and Description |
---|
FileSessionDataStore() |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(String id)
Delete a session
|
boolean |
deleteFile(String filename)
Delete the file associated with a session
|
Set<String> |
doGetExpired(Set<String> candidates)
Check to see which sessions have expired.
|
SessionData |
doLoad(String id)
Load the session from persistent store.
|
void |
doStore(String id,
SessionData data,
long lastSaveTime)
Store the session data persistently.
|
boolean |
exists(String id)
Test if data exists for a given session id.
|
File |
getStoreDir() |
void |
initialize(SessionContext context)
Initialize this data map for the
given context.
|
void |
initializeStore()
Read the names of the existing session files and build a map of
fully qualified session ids (ie with context) to filename.
|
boolean |
isDeleteUnrestorableFiles() |
boolean |
isPassivating()
True if this type of datastore will passivate session objects
|
void |
setDeleteUnrestorableFiles(boolean deleteUnrestorableFiles) |
void |
setStoreDir(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,
Path p)
Check to see if the expiry on the file is very old, and
delete the file if so.
|
String |
toString() |
getExpired, getGracePeriodSec, getSavePeriodSec, load, newSessionData, setGracePeriodSec, setSavePeriodSec, store
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stop
dumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, named
public void initialize(SessionContext context) throws Exception
SessionDataMap
initialize
in interface SessionDataMap
initialize
in class AbstractSessionDataStore
context
- context associatedException
- if unable to initialize the@ManagedAttribute(value="dir where sessions are stored", readonly=true) public File getStoreDir()
public void setStoreDir(File storeDir)
public boolean isDeleteUnrestorableFiles()
public void setDeleteUnrestorableFiles(boolean deleteUnrestorableFiles)
public boolean delete(String id) throws Exception
id
- session idException
- if unable to delete session datapublic boolean deleteFile(String filename) throws Exception
filename
- name of the file containing the session's informationException
- indicating delete failurepublic Set<String> doGetExpired(Set<String> candidates)
doGetExpired
in class AbstractSessionDataStore
candidates
- the set of session ids that the SessionCache believes
have expiredpublic void sweepDisk()
public void sweepFile(long now, Path p) throws Exception
now
- the time now in msecp
- the file to checkException
- indicating error in sweeppublic SessionData doLoad(String id) throws Exception
AbstractSessionDataStore
doLoad
in class AbstractSessionDataStore
id
- the id of the session to loadException
- if unable to load the sessionpublic void doStore(String id, SessionData data, long lastSaveTime) throws Exception
AbstractSessionDataStore
doStore
in class AbstractSessionDataStore
id
- identity of session to storedata
- info of the sessionlastSaveTime
- time of previous save or 0 if never savedException
- if unable to store datapublic void initializeStore() throws Exception
Exception
- if storeDir doesn't exist, isn't readable/writeable
or contains 2 files with the same lastmodify time for the same session. Throws IOException
if the lastmodifytimes can't be read.@ManagedAttribute(value="are sessions serialized by this store", readonly=true) public boolean isPassivating()
SessionDataStore
public boolean exists(String id) throws Exception
SessionDataStore
id
- Identity of session whose existence should be checkedException
- if problem checking existence with persistence layerpublic String toString()
toString
in class AbstractSessionDataStore
Copyright © 2010 - 2020 Adobe. All Rights Reserved