org.jboss.web.tomcat.tc5.session
Class JBossCacheManager

java.lang.Object
  extended byorg.jboss.web.tomcat.tc5.session.JBossManager (src) 
      extended byorg.jboss.web.tomcat.tc5.session.JBossCacheManager
All Implemented Interfaces:
AbstractJBossManager (src) , java.util.EventListener, JBossManagerMBean (src) , java.beans.PropertyChangeListener

public class JBossCacheManager
extends JBossManager (src)

Implementation of a clustered session manager for catalina using JBossCache replication.


Field Summary
protected  TransactionManager (src) tm
          The transaction manager.
protected  boolean useJK_
          If set to true, will add a JvmRouteFilter to the request.
 
Fields inherited from class org.jboss.web.tomcat.tc5.session.JBossManager (src)
activeCounter_, container_, createdCounter_, distributable_, expiredCounter_, invalidateSessionPolicy_, lifecycle_, log_, maxActive_, maxInactiveInterval_, objectName_, rejectedCounter_, replicationGranularity_, sessionIDGenerator_, sessionIdLength_, sessions_, started_, stats_, support_, timeSinceLastReset_, useLocalCache_
 
Constructor Summary
JBossCacheManager()
           
 
Method Summary
 void add(Session session)
           
 Session createEmptySession()
           
 Session createSession()
          Create a new session.
 Session createSession(java.lang.String sessionId)
          Create a new session.
protected  void endTransaction()
           
 org.jboss.web.tomcat.tc5.session.ClusteredSession findLocalSession(java.lang.String realId)
          Find in-memory sessions, if any.
 org.jboss.web.tomcat.tc5.session.ClusteredSession[] findLocalSessions()
          Find in-memory sessions, if any.
 Session findSession(java.lang.String id)
           
 Session[] findSessions()
          Return the sessions.
 JBossCacheService (src) getCacheService()
           
 void init(java.lang.String name, WebMetaData (src)  webMetaData, boolean useJK, boolean useLocalCache)
          Initialize the manager with the web metadata and
protected  Session loadSession(java.lang.String realId)
          Load a session from the distributed store
protected  void processExpires()
          Go through all sessions and look if they have expired.
protected  void processSessionRepl(org.jboss.web.tomcat.tc5.session.ClusteredSession session)
           
 void remove(Session session)
           
 void removeLocal(Session session)
          Remove the active session locally from the manager without replicating to the cluster.
 void start()
          Start this Manager
 void stop()
          Stop this Manager
 boolean storeSession(Session baseSession)
          Store the modified session.
 
Methods inherited from class org.jboss.web.tomcat.tc5.session.JBossManager (src)
addLifecycleListener, addPropertyChangeListener, backgroundProcess, findLifecycleListeners, getActiveSessionCount, getActiveSessions, getContainer, getCreatedSessionCount, getDistributable, getEngine, getExpiredSessionCount, getExpiredSessions, getInfo, getInvalidateSessionPolicy, getJvmRoute, getMaxActive, getMaxInactiveInterval, getNextId, getRejectedSessionCount, getRejectedSessions, getReplicationStatistics, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, isUseLocalCache, load, propertyChange, removeLifecycleListener, removePropertyChangeListener, reportReplicationStatistics, resetStats, setContainer, setDistributable, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setNewSessionCookie, setRejectedSessions, setSessionAverageAliveTime, setSessionCookie, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, startManager, stopManager, timeInSecondsSinceLastReset, unload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useJK_

protected boolean useJK_
If set to true, will add a JvmRouteFilter to the request.


tm

protected TransactionManager (src)  tm
The transaction manager.

Constructor Detail

JBossCacheManager

public JBossCacheManager()
Method Detail

init

public void init(java.lang.String name,
                 WebMetaData (src)  webMetaData,
                 boolean useJK,
                 boolean useLocalCache)
          throws ClusteringNotSupportedException (src) 
Description copied from interface: AbstractJBossManager (src)
Initialize the manager with the web metadata and

Specified by:
init in interface AbstractJBossManager (src)
Overrides:
init in class JBossManager (src)
Throws:
ClusteringNotSupportedException (src)

getCacheService

public JBossCacheService (src)  getCacheService()

start

public void start()
           throws LifecycleException
Start this Manager

Overrides:
start in class JBossManager (src)
Throws:
org.apache.catalina.LifecycleException
LifecycleException

stop

public void stop()
          throws LifecycleException
Description copied from class: JBossManager (src)
Stop this Manager

Overrides:
stop in class JBossManager (src)
Throws:
LifecycleException

createSession

public Session createSession()
Create a new session. Note this does not mean the session is active yet.


createSession

public Session createSession(java.lang.String sessionId)
Create a new session. Note this does not mean the session is active yet.


storeSession

public boolean storeSession(Session baseSession)
Description copied from class: JBossManager (src)
Store the modified session.

Specified by:
storeSession in interface AbstractJBossManager (src)
Specified by:
storeSession in class JBossManager (src)
Parameters:
baseSession -

add

public void add(Session session)

createEmptySession

public Session createEmptySession()

findSession

public Session findSession(java.lang.String id)

findSessions

public Session[] findSessions()
Return the sessions. We will find it from the in-memory local ones first. If not found, we search for the underlying store as well just to be sure.

Returns:

findLocalSessions

public org.jboss.web.tomcat.tc5.session.ClusteredSession[] findLocalSessions()
Description copied from class: JBossManager (src)
Find in-memory sessions, if any.

Specified by:
findLocalSessions in class JBossManager (src)
Returns:
local session found. Sessions of size 0, if not found.

findLocalSession

public org.jboss.web.tomcat.tc5.session.ClusteredSession findLocalSession(java.lang.String realId)
Description copied from class: JBossManager (src)
Find in-memory sessions, if any.

Specified by:
findLocalSession in class JBossManager (src)
Parameters:
realId - the Session id without JvmRoute tag.
Returns:
local session found. Null if not found.

remove

public void remove(Session session)

removeLocal

public void removeLocal(Session session)
Description copied from class: JBossManager (src)
Remove the active session locally from the manager without replicating to the cluster. This can be useful when the session is exipred, for example, where there is not need to propagate the expiration.

Specified by:
removeLocal in interface AbstractJBossManager (src)
Specified by:
removeLocal in class JBossManager (src)
Parameters:
session -

loadSession

protected Session loadSession(java.lang.String realId)
Load a session from the distributed store

Parameters:
realId - The session-id for the session to load without JvmRoute
Returns:
the session or null if the session cannot be found in the distributed store

processSessionRepl

protected void processSessionRepl(org.jboss.web.tomcat.tc5.session.ClusteredSession session)

endTransaction

protected void endTransaction()

processExpires

protected void processExpires()
Go through all sessions and look if they have expired. Note this overrides the method in JBossManager.

Overrides:
processExpires in class JBossManager (src)