GigaSpaces XAP 7.0 API

org.openspaces.jee.sessions.jetty
Class GigaSessionManager

java.lang.Object
  extended by org.mortbay.component.AbstractLifeCycle
      extended by org.mortbay.jetty.servlet.AbstractSessionManager
          extended by org.openspaces.jee.sessions.jetty.GigaSessionManager
All Implemented Interfaces:
org.mortbay.component.LifeCycle, org.mortbay.jetty.SessionManager

public class GigaSessionManager
extends org.mortbay.jetty.servlet.AbstractSessionManager

GigaspacesSessionManager A Jetty SessionManager where the session data is stored in a data grid "cloud". On each request, the session data is looked up in the "cloud" and brought into the local space cache if doesn't already exist, and an entry put into the managers map of sessions. When the request exists, any changes, including changes to the access time of the session are written back out to the grid.


Nested Class Summary
 class GigaSessionManager.Session
          Session A session in memory of a Context.
 
Nested classes/interfaces inherited from class org.mortbay.jetty.servlet.AbstractSessionManager
org.mortbay.jetty.servlet.AbstractSessionManager.NullSessionContext, org.mortbay.jetty.servlet.AbstractSessionManager.SessionIf
 
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
org.mortbay.component.LifeCycle.Listener
 
Field Summary
protected  int _savePeriodMs
           
protected  int _scavengeCount
           
protected  int _scavengePeriodMs
           
 
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 class org.mortbay.component.AbstractLifeCycle
_listeners
 
Fields inherited from interface org.mortbay.jetty.SessionManager
__DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionURL, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionPathProperty, __SessionURLProperty
 
Constructor Summary
GigaSessionManager()
           
 
Method Summary
protected  void add(SessionData data)
           
protected  void addSession(org.mortbay.jetty.servlet.AbstractSessionManager.Session abstractSession)
           
protected  boolean delete(String id)
           
 void doStart()
          Start the session manager.
 void doStop()
          Stop the session manager.
protected  SessionData fetch(String sessionId)
           
protected  Object[] findExpiredSessions(long timestamp)
           
 BeanLevelProperties getBeanLevelProperties()
           
 ClusterInfo getClusterInfo()
           
 int getSavePeriod()
          How often an actual update of the session will be perfomed to the Space.
 int getScavengePeriod()
          How often the scavanger thread will run in order to check for expired sessions.
 GigaSessionManager.Session getSession(String idInCluster)
          Get a session matching the id.
 Map getSessionMap()
           
 int getSessions()
           
 IJSpace getSpace()
           
 String getSpaceUrl()
           
 void invalidateSession(String idInCluster)
           
protected  void invalidateSessions()
           
protected  GigaSessionManager.Session newSession(javax.servlet.http.HttpServletRequest request)
           
 void removeSession(org.mortbay.jetty.servlet.AbstractSessionManager.Session abstractSession, boolean invalidate)
           
protected  void removeSession(String idInCluster)
           
 void resetStats()
           
protected  void scavenge()
          Look for expired sessions that we know about in our session map, and double check with the grid that it has really expired, or already been removed.
 void setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
           
 void setClusterInfo(ClusterInfo clusterInfo)
           
 void setCountSessionPeriod(int seconds)
           
 void setLease(long lease)
          The lease of the SessionData that is written to the Space.
 void setSavePeriod(int seconds)
          How often an actual update of the session will be perfomed to the Space.
 void setScavengePeriod(int seconds)
          How often the scavanger thread will run in order to check for expired sessions.
 void setSpace(IJSpace space)
           
 void setSpaceUrl(String url)
           
protected  void update(SessionData data)
           
 
Methods inherited from class org.mortbay.jetty.servlet.AbstractSessionManager
access, addEventListener, addSession, clearEventListeners, complete, 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, 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
 

Field Detail

_scavengePeriodMs

protected int _scavengePeriodMs

_scavengeCount

protected int _scavengeCount

_savePeriodMs

protected int _savePeriodMs
Constructor Detail

GigaSessionManager

public GigaSessionManager()
Method Detail

doStart

public void doStart()
             throws Exception
Start the session manager.

Overrides:
doStart in class org.mortbay.jetty.servlet.AbstractSessionManager
Throws:
Exception
See Also:
AbstractSessionManager.doStart()

doStop

public void doStop()
            throws Exception
Stop the session manager.

Overrides:
doStop in class org.mortbay.jetty.servlet.AbstractSessionManager
Throws:
Exception
See Also:
AbstractSessionManager.doStop()

getSavePeriod

public int getSavePeriod()
How often an actual update of the session will be perfomed to the Space. Set in seconds and defaults to 60 seconds.


setSavePeriod

public void setSavePeriod(int seconds)
How often an actual update of the session will be perfomed to the Space. Set in seconds and defaults to 60 seconds.


getScavengePeriod

public int getScavengePeriod()
How often the scavanger thread will run in order to check for expired sessions. Set in seconds and defaults to 60 * 5 seconds (5 minutes).


setScavengePeriod

public void setScavengePeriod(int seconds)
How often the scavanger thread will run in order to check for expired sessions. Set in seconds and defaults to 60 * 5 seconds (5 minutes).


setCountSessionPeriod

public void setCountSessionPeriod(int seconds)

setSpace

public void setSpace(IJSpace space)

getSpace

public IJSpace getSpace()

setSpaceUrl

public void setSpaceUrl(String url)

getSpaceUrl

public String getSpaceUrl()

getClusterInfo

public ClusterInfo getClusterInfo()

setClusterInfo

public void setClusterInfo(ClusterInfo clusterInfo)

getBeanLevelProperties

public BeanLevelProperties getBeanLevelProperties()

setBeanLevelProperties

public void setBeanLevelProperties(BeanLevelProperties beanLevelProperties)

setLease

public void setLease(long lease)
The lease of the SessionData that is written to the Space. Set in seconds and defaults to FOREVER.


getSession

public GigaSessionManager.Session getSession(String idInCluster)
Get a session matching the id. Look in the grid to see if such a session exists, as it may have moved from another node.

Specified by:
getSession in class org.mortbay.jetty.servlet.AbstractSessionManager
See Also:
AbstractSessionManager.getSession(java.lang.String)

getSessionMap

public Map getSessionMap()
Specified by:
getSessionMap in class org.mortbay.jetty.servlet.AbstractSessionManager

getSessions

public int getSessions()
Specified by:
getSessions in class org.mortbay.jetty.servlet.AbstractSessionManager

resetStats

public void resetStats()
Overrides:
resetStats in class org.mortbay.jetty.servlet.AbstractSessionManager

invalidateSessions

protected void invalidateSessions()
Specified by:
invalidateSessions in class org.mortbay.jetty.servlet.AbstractSessionManager

newSession

protected GigaSessionManager.Session newSession(javax.servlet.http.HttpServletRequest request)
Specified by:
newSession in class org.mortbay.jetty.servlet.AbstractSessionManager

removeSession

protected void removeSession(String idInCluster)
Specified by:
removeSession in class org.mortbay.jetty.servlet.AbstractSessionManager

removeSession

public void removeSession(org.mortbay.jetty.servlet.AbstractSessionManager.Session abstractSession,
                          boolean invalidate)
Overrides:
removeSession in class org.mortbay.jetty.servlet.AbstractSessionManager

invalidateSession

public void invalidateSession(String idInCluster)

addSession

protected void addSession(org.mortbay.jetty.servlet.AbstractSessionManager.Session abstractSession)
Specified by:
addSession in class org.mortbay.jetty.servlet.AbstractSessionManager

scavenge

protected void scavenge()
Look for expired sessions that we know about in our session map, and double check with the grid that it has really expired, or already been removed.


add

protected void add(SessionData data)
            throws Exception
Throws:
Exception

delete

protected boolean delete(String id)
                  throws Exception
Throws:
Exception

update

protected void update(SessionData data)
               throws Exception
Throws:
Exception

fetch

protected SessionData fetch(String sessionId)
                     throws Exception
Throws:
Exception

findExpiredSessions

protected Object[] findExpiredSessions(long timestamp)
                                throws Exception
Throws:
Exception

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.