org.eclipse.jetty.nosql
Class NoSqlSessionManager

java.lang.Object
  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.server.session.AbstractSessionManager
          extended by org.eclipse.jetty.nosql.NoSqlSessionManager
All Implemented Interfaces:
SessionManager, LifeCycle
Direct Known Subclasses:
MongoSessionManager

public abstract class NoSqlSessionManager
extends AbstractSessionManager
implements SessionManager


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jetty.server.session.AbstractSessionManager
AbstractSessionManager.SessionIf
 
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
 
Field Summary
protected  ConcurrentMap<String,NoSqlSession> _sessions
           
 
Fields inherited from class org.eclipse.jetty.server.session.AbstractSessionManager
__defaultSessionTrackingModes, __distantFuture, _checkingRemoteSessionIdEncoding, _context, _dftMaxIdleSecs, _httpOnly, _loader, _maxCookieAge, _nodeIdInSessionId, _refreshCookieAge, _secureCookies, _sessionAttributeListeners, _sessionComment, _sessionCookie, _sessionDomain, _sessionHandler, _sessionIdManager, _sessionIdPathParameterName, _sessionIdPathParameterNamePrefix, _sessionListeners, _sessionPath, _sessionsStats, _sessionTimeStats, _sessionTrackingModes
 
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
__CheckRemoteSessionEncoding, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty
 
Constructor Summary
NoSqlSessionManager()
           
 
Method Summary
protected  void addSession(AbstractSession session)
           
 void doStart()
           
 int getIdlePeriod()
          The Idle Period is the time in seconds before an in memory session is passivated.
 int getSavePeriod()
          The Save Period is the time in seconds between saves of a dirty session to the DB.
 AbstractSession getSession(String idInCluster)
          Get a known existing session
 int getStalePeriod()
          The State Period is the maximum time in seconds that an in memory session is allows to be stale: If this period is exceeded, the DB will be checked to see if a more recent version is available. If the state period is set to a value < 0, then no staleness check will be made. If the state period is set to 0, then a staleness check is made whenever the active request count goes from 0 to 1.
protected  void invalidateSession(String idInCluster)
           
protected  void invalidateSessions()
           
 boolean isInvalidateOnStop()
          Invalidate sessions when the session manager is stopped otherwise save them to the DB.
 boolean isSaveAllAttributes()
          Save all attributes of a session or only update the dirty attributes.
protected abstract  NoSqlSession loadSession(String clusterId)
           
protected  AbstractSession newSession(HttpServletRequest request)
          Create a new session instance
protected abstract  Object refresh(NoSqlSession session, Object version)
           
protected abstract  boolean remove(NoSqlSession session)
           
protected  boolean removeSession(String idInCluster)
           
protected abstract  Object save(NoSqlSession session, Object version, boolean activateAfterSave)
           
 void setIdlePeriod(int idlePeriod)
          The Idle Period is the time in seconds before an in memory session is passivated.
 void setInvalidateOnStop(boolean invalidateOnStop)
          Invalidate sessions when the session manager is stopped otherwise save them to the DB.
 void setSaveAllAttributes(boolean saveAllAttributes)
          Save all attributes of a session or only update the dirty attributes.
 void setSavePeriod(int savePeriod)
          The Save Period is the time in seconds between saves of a dirty session to the DB.
 void setStalePeriod(int stalePeriod)
          The State Period is the maximum time in seconds that an in memory session is allows to be stale: If this period is exceeded, the DB will be checked to see if a more recent version is available. If the state period is set to a value < 0, then no staleness check will be made. If the state period is set to 0, then a staleness check is made whenever the active request count goes from 0 to 1.
 
Methods inherited from class org.eclipse.jetty.server.session.AbstractSessionManager
access, addEventListener, addSession, clearEventListeners, complete, doSessionAttributeListeners, doStop, getClusterId, getContext, getContextHandler, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getIdManager, getMaxInactiveInterval, getMaxSessions, getMetaManager, getMinSessions, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionCookieConfig, getSessionDomain, getSessionHandler, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, getSessionMap, getSessions, getSessionsMax, getSessionsTotal, getSessionTimeMax, getSessionTimeMean, getSessionTimeStdDev, getSessionTimeTotal, isCheckingRemoteSessionIdEncoding, isNodeIdInSessionId, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, removeSession, removeSession, resetStats, setCheckingRemoteSessionIdEncoding, setHttpOnly, setIdManager, setMaxInactiveInterval, setNodeIdInSessionId, setRefreshCookieAge, setSessionCookie, setSessionHandler, setSessionIdManager, setSessionIdPathParameterName, setSessionTrackingModes, setUsingCookies, statsReset
 
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jetty.server.SessionManager
access, addEventListener, clearEventListeners, complete, getClusterId, getDefaultSessionTrackingModes, getEffectiveSessionTrackingModes, getHttpOnly, getHttpSession, getMaxInactiveInterval, getMetaManager, getNodeId, getSessionCookie, getSessionCookieConfig, getSessionIdManager, getSessionIdPathParameterName, getSessionIdPathParameterNamePrefix, isCheckingRemoteSessionIdEncoding, isUsingCookies, isUsingURLs, isValid, newHttpSession, removeEventListener, setCheckingRemoteSessionIdEncoding, setMaxInactiveInterval, setSessionHandler, setSessionIdManager, setSessionIdPathParameterName, setSessionTrackingModes
 
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Field Detail

_sessions

protected final ConcurrentMap<String,NoSqlSession> _sessions
Constructor Detail

NoSqlSessionManager

public NoSqlSessionManager()
Method Detail

doStart

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

addSession

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

getSession

public AbstractSession getSession(String idInCluster)
Description copied from class: AbstractSessionManager
Get a known existing session

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()
                           throws Exception
Specified by:
invalidateSessions in class AbstractSessionManager
Throws:
Exception

newSession

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

Specified by:
newSession in class AbstractSessionManager
Returns:
the new session

removeSession

protected boolean removeSession(String idInCluster)
Specified by:
removeSession in class AbstractSessionManager

invalidateSession

protected void invalidateSession(String idInCluster)

getStalePeriod

public int getStalePeriod()
The State Period is the maximum time in seconds that an in memory session is allows to be stale:

Returns:
the stalePeriod in seconds

setStalePeriod

public void setStalePeriod(int stalePeriod)
The State Period is the maximum time in seconds that an in memory session is allows to be stale:

Parameters:
stalePeriod - the stalePeriod in seconds

getSavePeriod

public int getSavePeriod()
The Save Period is the time in seconds between saves of a dirty session to the DB. When this period is exceeded, the a dirty session will be written to the DB:

Returns:
the savePeriod -2,-1,0,1 or the period in seconds >=2

setSavePeriod

public void setSavePeriod(int savePeriod)
The Save Period is the time in seconds between saves of a dirty session to the DB. When this period is exceeded, the a dirty session will be written to the DB:

Parameters:
savePeriod - the savePeriod -2,-1,0,1 or the period in seconds >=2

getIdlePeriod

public int getIdlePeriod()
The Idle Period is the time in seconds before an in memory session is passivated. When this period is exceeded, the session will be passivated and removed from memory. If the session was dirty, it will be written to the DB. If the idle period is set to a value < 0, then the session is never idled. If the save period is set to 0, then the session is idled whenever the active request count goes from 1 to 0.

Returns:
the idlePeriod

setIdlePeriod

public void setIdlePeriod(int idlePeriod)
The Idle Period is the time in seconds before an in memory session is passivated. When this period is exceeded, the session will be passivated and removed from memory. If the session was dirty, it will be written to the DB. If the idle period is set to a value < 0, then the session is never idled. If the save period is set to 0, then the session is idled whenever the active request count goes from 1 to 0.

Parameters:
idlePeriod - the idlePeriod in seconds

isInvalidateOnStop

public boolean isInvalidateOnStop()
Invalidate sessions when the session manager is stopped otherwise save them to the DB.

Returns:
the invalidateOnStop

setInvalidateOnStop

public void setInvalidateOnStop(boolean invalidateOnStop)
Invalidate sessions when the session manager is stopped otherwise save them to the DB.

Parameters:
invalidateOnStop - the invalidateOnStop to set

isSaveAllAttributes

public boolean isSaveAllAttributes()
Save all attributes of a session or only update the dirty attributes.

Returns:
the saveAllAttributes

setSaveAllAttributes

public void setSaveAllAttributes(boolean saveAllAttributes)
Save all attributes of a session or only update the dirty attributes.

Parameters:
saveAllAttributes - the saveAllAttributes to set

loadSession

protected abstract NoSqlSession loadSession(String clusterId)

save

protected abstract Object save(NoSqlSession session,
                               Object version,
                               boolean activateAfterSave)

refresh

protected abstract Object refresh(NoSqlSession session,
                                  Object version)

remove

protected abstract boolean remove(NoSqlSession session)


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