org.eclipse.jetty.server.session
Class HashSessionManager

java.lang.Object
  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.server.session.AbstractSessionManager
          extended by org.eclipse.jetty.server.session.HashSessionManager
All Implemented Interfaces:
SessionManager, LifeCycle

public class HashSessionManager
extends AbstractSessionManager

An in-memory implementation of SessionManager.


Nested Class Summary
protected  class HashSessionManager.ClassLoadingObjectInputStream
           
protected  class HashSessionManager.Session
           
 
Nested classes/interfaces inherited from class org.eclipse.jetty.server.session.AbstractSessionManager
AbstractSessionManager.NullSessionContext, AbstractSessionManager.SessionIf
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
 
Field Summary
protected  Map _sessions
           
 
Fields inherited from class org.eclipse.jetty.server.session.AbstractSessionManager
__distantFuture, _context, _dftMaxIdleSecs, _httpOnly, _loader, _maxCookieAge, _maxSessions, _minSessions, _nodeIdInSessionId, _refreshCookieAge, _secureCookies, _sessionAttributeListeners, _sessionCookie, _sessionDomain, _sessionHandler, _sessionIdManager, _sessionIdPathParameterName, _sessionIdPathParameterNamePrefix, _sessionListeners, _sessionPath
 
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
Fields inherited from interface org.eclipse.jetty.server.SessionManager
__DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty
 
Constructor Summary
HashSessionManager()
           
 
Method Summary
protected  void addSession(AbstractSessionManager.Session session)
           
 void doStart()
           
 void doStop()
           
 int getSavePeriod()
           
 int getScavengePeriod()
           
 AbstractSessionManager.Session getSession(String idInCluster)
          Get a known existingsession
 Map getSessionMap()
           
 int getSessions()
           
 File getStoreDirectory()
           
protected  void invalidateSessions()
           
 boolean isLazyLoad()
           
protected  AbstractSessionManager.Session newSession(HttpServletRequest request)
          Create a new session instance
protected  AbstractSessionManager.Session newSession(long created, String clusterId)
           
protected  void removeSession(String clusterId)
           
 HashSessionManager.Session restoreSession(InputStream is)
           
 void restoreSessions()
           
 void saveSessions()
           
 void setLazyLoad(boolean lazyLoad)
           
 void setMaxInactiveInterval(int seconds)
          Sets the max period of inactivity, after which the session is invalidated, in seconds.
 void setSavePeriod(int seconds)
           
 void setScavengePeriod(int seconds)
           
 void setStoreDirectory(File dir)
           
 
Methods inherited from class org.eclipse.jetty.server.session.AbstractSessionManager
access, addEventListener, addSession, clearEventListeners, complete, getClusterId, getHttpOnly, getHttpSession, getIdManager, getMaxCookieAge, getMaxInactiveInterval, getMaxSessions, getMetaManager, getMinSessions, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionDomain, getSessionHandler, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionPath, isNodeIdInSessionId, isUsingCookies, isValid, newHttpSession, removeEventListener, removeSession, removeSession, resetStats, setHttpOnly, setIdManager, setMaxCookieAge, setMetaManager, setNodeIdInSessionId, setRefreshCookieAge, setSecureCookies, setSessionCookie, setSessionDomain, setSessionHandler, setSessionIdPathParameterName, setSessionPath, setUsingCookies
 
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Field Detail

_sessions

protected Map _sessions
Constructor Detail

HashSessionManager

public HashSessionManager()
Method Detail

doStart

public void doStart()
             throws Exception
Overrides:
doStart in class AbstractSessionManager
Throws:
Exception

doStop

public void doStop()
            throws Exception
Overrides:
doStop in class AbstractSessionManager
Throws:
Exception

getScavengePeriod

public int getScavengePeriod()
Returns:
seconds

getSessionMap

public Map getSessionMap()
Specified by:
getSessionMap in class AbstractSessionManager

getSessions

public int getSessions()
Specified by:
getSessions in class AbstractSessionManager

setMaxInactiveInterval

public void setMaxInactiveInterval(int seconds)
Description copied from interface: SessionManager
Sets the max period of inactivity, after which the session is invalidated, in seconds.

Specified by:
setMaxInactiveInterval in interface SessionManager
Overrides:
setMaxInactiveInterval in class AbstractSessionManager
Parameters:
seconds - the max inactivity period, in seconds.
See Also:
SessionManager.getMaxInactiveInterval()

setSavePeriod

public void setSavePeriod(int seconds)

getSavePeriod

public int getSavePeriod()

setScavengePeriod

public void setScavengePeriod(int seconds)
Parameters:
seconds -

addSession

protected void addSession(AbstractSessionManager.Session session)
Specified by:
addSession in class AbstractSessionManager

getSession

public AbstractSessionManager.Session getSession(String idInCluster)
Description copied from class: AbstractSessionManager
Get a known existingsession

Specified by:
getSession in class AbstractSessionManager
Parameters:
idInCluster - The session ID in the cluster, stripped of any worker name.
Returns:
A Session or null if none exists.

invalidateSessions

protected void invalidateSessions()
Specified by:
invalidateSessions in class AbstractSessionManager

newSession

protected AbstractSessionManager.Session newSession(HttpServletRequest request)
Description copied from class: AbstractSessionManager
Create a new session instance

Specified by:
newSession in class AbstractSessionManager
Returns:

newSession

protected AbstractSessionManager.Session newSession(long created,
                                                    String clusterId)

removeSession

protected void removeSession(String clusterId)
Specified by:
removeSession in class AbstractSessionManager

setStoreDirectory

public void setStoreDirectory(File dir)

getStoreDirectory

public File getStoreDirectory()

setLazyLoad

public void setLazyLoad(boolean lazyLoad)

isLazyLoad

public boolean isLazyLoad()

restoreSessions

public void restoreSessions()
                     throws Exception
Throws:
Exception

saveSessions

public void saveSessions()
                  throws Exception
Throws:
Exception

restoreSession

public HashSessionManager.Session restoreSession(InputStream is)
                                          throws Exception
Throws:
Exception


Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.