org.mortbay.jetty.servlet.wadi
Class WadiSessionManager

java.lang.Object
  extended by org.mortbay.component.AbstractLifeCycle
      extended by org.mortbay.jetty.servlet.AbstractSessionManager
          extended by org.mortbay.jetty.servlet.wadi.WadiSessionManager
All Implemented Interfaces:
LifeCycle, SessionManager

public class WadiSessionManager
extends AbstractSessionManager


Nested Class Summary
 class WadiSessionManager.ClusteredSession
           
 
Nested classes/interfaces inherited from class org.mortbay.jetty.servlet.AbstractSessionManager
AbstractSessionManager.NullSessionContext, AbstractSessionManager.Session, AbstractSessionManager.SessionIf
 
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
LifeCycle.Listener
 
Field Summary
 
Fields inherited from class org.mortbay.jetty.servlet.AbstractSessionManager
__distantFuture, _context, _dftMaxIdleSecs, _httpOnly, _loader, _maxCookieAge, _maxSessions, _minSessions, _nodeIdInSessionId, _refreshCookieAge, _secureCookies, _sessionAttributeListeners, _sessionCookie, _sessionDomain, _sessionHandler, _sessionIdManager, _sessionListeners, _sessionPath, _sessionURL, _sessionURLPrefix
 
Fields inherited from interface org.mortbay.jetty.SessionManager
__DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionURL, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionPathProperty, __SessionURLProperty
 
Constructor Summary
WadiSessionManager(WadiCluster wadiCluster, int numPartitions, int sweepInterval)
           
WadiSessionManager(WadiCluster wadiCluster, int nbReplica, int numPartitions, int sweepInterval)
           
WadiSessionManager(WadiCluster wadiCluster, int nbReplica, int numPartitions, int sweepInterval, boolean enableReplication, boolean deltaReplication)
          Constructs a session manager attached to the provided cluster.
 
Method Summary
protected  void addSession(AbstractSessionManager.Session session)
           
 void complete(HttpSession session)
          Called by the SessionHandler when a reqeuest is not longer handling a session.
 WadiSession createSession(java.lang.String sessionId)
           
 void doStart()
           
 void doStop()
           
 org.codehaus.wadi.core.manager.Manager getClusteredManager()
           
 AbstractSessionManager.Session getSession(java.lang.String idInCluster)
          Get a known existingsession
 java.util.Map getSessionMap()
           
 int getSessions()
           
 org.codehaus.wadi.core.store.Store getSharedStore()
           
protected  void invalidateSessions()
           
protected  AbstractSessionManager.Session newSession(HttpServletRequest request)
          Create a new session instance
 void registerListener(SessionListener listener)
           
protected  void removeSession(java.lang.String idInCluster)
           
 void setSharedStore(org.codehaus.wadi.core.store.Store store)
           
 void unregisterListener(SessionListener listener)
           
 
Methods inherited from class org.mortbay.jetty.servlet.AbstractSessionManager
access, addEventListener, addSession, clearEventListeners, getClusterId, getHttpOnly, getHttpSession, getIdManager, getMaxCookieAge, getMaxInactiveInterval, getMaxSessions, getMetaManager, getMinSessions, getNodeId, getRefreshCookieAge, getSecureCookies, getSessionCookie, getSessionCookie, getSessionDomain, getSessionHandler, getSessionPath, getSessionURL, getSessionURLPrefix, isNodeIdInSessionId, isUsingCookies, isValid, newHttpSession, removeEventListener, removeSession, removeSession, resetStats, setHttpOnly, setIdManager, setMaxCookieAge, setMaxInactiveInterval, setMetaManager, setNodeIdInSessionId, setRefreshCookieAge, setSecureCookies, setSessionCookie, setSessionDomain, setSessionHandler, setSessionPath, setSessionURL, setUsingCookies
 
Methods inherited from class org.mortbay.component.AbstractLifeCycle
addLifeCycleListener, 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.mortbay.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Constructor Detail

WadiSessionManager

public WadiSessionManager(WadiCluster wadiCluster,
                          int numPartitions,
                          int sweepInterval)

WadiSessionManager

public WadiSessionManager(WadiCluster wadiCluster,
                          int nbReplica,
                          int numPartitions,
                          int sweepInterval)

WadiSessionManager

public WadiSessionManager(WadiCluster wadiCluster,
                          int nbReplica,
                          int numPartitions,
                          int sweepInterval,
                          boolean enableReplication,
                          boolean deltaReplication)
Constructs a session manager attached to the provided cluster.

Parameters:
wadiCluster - cluster this session manager is attached to.
nbReplica - number of replicas to be maintained for each sessions managed by this session manager. When a session is created or updated, it is replicated to a configurable number of other nodes.
numPartitions - WADI maintains a distributed and indexed look-up map tracking HttpSession locations. numPartitions is the number of indexes of this look-up map. A standard number of partitions is 24.
sweepInterval - number of seconds between the execution of HttpSession eviction policies. In other words, it is how often HttpSessions are scanned to identify and invalidate timed out sessions
enableReplication - if true, then sessions are replicated to other nodes. The number of replicas is configured by nbReplica.
Method Detail

getSharedStore

public org.codehaus.wadi.core.store.Store getSharedStore()

setSharedStore

public void setSharedStore(org.codehaus.wadi.core.store.Store store)

doStart

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

doStop

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

getClusteredManager

public org.codehaus.wadi.core.manager.Manager getClusteredManager()

createSession

public WadiSession createSession(java.lang.String sessionId)
                          throws SessionAlreadyExistsException
Throws:
SessionAlreadyExistsException

registerListener

public void registerListener(SessionListener listener)

unregisterListener

public void unregisterListener(SessionListener listener)

newSession

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

Specified by:
newSession in class AbstractSessionManager
Returns:

complete

public void complete(HttpSession session)
Description copied from interface: SessionManager
Called by the SessionHandler when a reqeuest is not longer handling a session. Not this includes new sessions, so there may not be a matching call to #access(HttpSession).

Specified by:
complete in interface SessionManager
Overrides:
complete in class AbstractSessionManager

addSession

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

removeSession

protected void removeSession(java.lang.String idInCluster)
Specified by:
removeSession in class AbstractSessionManager

getSession

public AbstractSessionManager.Session getSession(java.lang.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.

getSessions

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

getSessionMap

public java.util.Map getSessionMap()
Specified by:
getSessionMap in class AbstractSessionManager

invalidateSessions

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


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