Class FileSessionStore

All Implemented Interfaces:
Component, SessionStore

public class FileSessionStore extends AbstractSessionStore
A file-based store of session data.
  • Constructor Details

    • FileSessionStore

      public FileSessionStore()
  • Method Details

    • getStoreDir

      public File getStoreDir()
    • setStoreDir

      public void setStoreDir(File storeDir)
    • isDeleteUnrestorableFiles

      public boolean isDeleteUnrestorableFiles()
    • setDeleteUnrestorableFiles

      public void setDeleteUnrestorableFiles(boolean deleteUnrestorableFiles)
    • load

      public SessionData load(String id) throws Exception
      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

      public boolean delete(String id) throws IOException
      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

      public boolean exists(String id)
      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

      public void doSave(String id, SessionData data) throws Exception
      Description copied from class: AbstractSessionStore
      Store the session data persistently.
      Specified by:
      doSave in class AbstractSessionStore
      Parameters:
      id - identity of session to store
      data - info of the session
      Throws:
      Exception - if unable to store data
    • doGetExpired

      public Set<String> doGetExpired(long time)
      Check to see which sessions have expired.
      Specified by:
      doGetExpired in class AbstractSessionStore
      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 class AbstractSessionStore
      Parameters:
      time - the upper limit of the expiry time to check in msec
    • getAllSessions

      public Set<String> getAllSessions()
    • doInitialize

      protected void doInitialize() throws Exception
      Specified by:
      doInitialize in class AbstractComponent
      Throws:
      Exception
    • doDestroy

      protected void doDestroy()
      Specified by:
      doDestroy in class AbstractComponent
    • toString

      public String toString()
      Overrides:
      toString in class Object