Class FileSessionStore
java.lang.Object
com.aspectran.core.component.AbstractComponent
com.aspectran.core.component.session.AbstractSessionStore
com.aspectran.core.component.session.FileSessionStore
- All Implemented Interfaces:
Component
,SessionStore
A file-based store of session data.
-
Field Summary
Fields inherited from class com.aspectran.core.component.session.AbstractSessionStore
DEFAULT_GRACE_PERIOD_SECS, DEFAULT_SAVE_PERIOD_SECS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Delete session data.void
doCleanOrphans
(long time) Implemented by subclasses to delete unmanaged sessions that expired before a specified time.protected void
doGetExpired
(long time) Check to see which sessions have expired.protected void
void
doSave
(String id, SessionData data) Store the session data persistently.boolean
Test if data exists for a given session id.boolean
Read in session data.void
setDeleteUnrestorableFiles
(boolean deleteUnrestorableFiles) void
setStoreDir
(File storeDir) toString()
Methods inherited from class com.aspectran.core.component.session.AbstractSessionStore
checkAlreadyInitialized, checkExpiry, checkInitialized, cleanOrphans, getExpired, getGracePeriodMillis, getGracePeriodSecs, getNonPersistentAttributes, getSavePeriodMillis, getSavePeriodSecs, isNonPersistentAttributes, save, setGracePeriodSecs, setNonPersistentAttributes, setSavePeriodSecs
Methods inherited from class com.aspectran.core.component.AbstractComponent
destroy, getComponentName, initialize, isAvailable, isDestroyed, isDestroying, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.aspectran.core.component.Component
destroy, getComponentName, initialize, isAvailable, isDestroyed, isDestroying, isInitialized
-
Constructor Details
-
FileSessionStore
public FileSessionStore()
-
-
Method Details
-
getStoreDir
-
setStoreDir
-
isDeleteUnrestorableFiles
public boolean isDeleteUnrestorableFiles() -
setDeleteUnrestorableFiles
public void setDeleteUnrestorableFiles(boolean deleteUnrestorableFiles) -
load
Description copied from interface:SessionStore
Read in session data.- Parameters:
id
- identity of session to load- Returns:
- the SessionData matching the id
- Throws:
Exception
- if unable to load session data
-
delete
Description copied from interface:SessionStore
Delete session data.- Parameters:
id
- identity of session to delete- Returns:
- true if the session was deleted
- Throws:
IOException
-
exists
Description copied from interface:SessionStore
Test if data exists for a given session id.- Parameters:
id
- Identity of session whose existence should be checked- Returns:
- true if valid, non-expired session exists
-
doSave
Description copied from class:AbstractSessionStore
Store the session data persistently.- Specified by:
doSave
in classAbstractSessionStore
- Parameters:
id
- identity of session to storedata
- info of the session- Throws:
Exception
- if unable to store data
-
doGetExpired
Check to see which sessions have expired.- Specified by:
doGetExpired
in classAbstractSessionStore
- Parameters:
time
- the upper limit of expiry times to check- Returns:
- the complete set of sessions that have expired, including those that are not currently loaded into the SessionCache
-
doCleanOrphans
public void doCleanOrphans(long time) Description copied from class:AbstractSessionStore
Implemented by subclasses to delete unmanaged sessions that expired before a specified time. This is to remove 'orphaned' sessions that are no longer actively managed on any node, while sessions that are explicitly managed on each node are handled by other mechanisms such as doGetExpired.This is called only periodically to avoid placing excessive load on the store.
- Specified by:
doCleanOrphans
in classAbstractSessionStore
- Parameters:
time
- the upper limit of the expiry time to check in msec
-
getAllSessions
-
doInitialize
- Specified by:
doInitialize
in classAbstractComponent
- Throws:
Exception
-
doDestroy
protected void doDestroy()- Specified by:
doDestroy
in classAbstractComponent
-
toString
-