org.jboss.web.tomcat.service.session
Class JBossCacheSipManager

java.lang.Object
  extended by org.jboss.web.tomcat.service.session.JBossManager
      extended by org.jboss.web.tomcat.service.session.JBossCacheManager
          extended by org.jboss.web.tomcat.service.session.JBossCacheSipManager
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, org.apache.catalina.Lifecycle, org.apache.catalina.Manager, org.jboss.web.tomcat.service.session.AbstractJBossManager, org.jboss.web.tomcat.service.session.JBossCacheManagerMBean, org.jboss.web.tomcat.service.session.JBossManagerMBean, SipManager

public class JBossCacheSipManager
extends org.jboss.web.tomcat.service.session.JBossCacheManager
implements SipManager

Implementation of a converged clustered session manager for catalina using JBossCache replication. Based on JbossCacheManager JBOSS AS 4.2.2 Tag I was forced to copy over most of the code since some things that needed to be adapted were private

Author:
Ben Wang, Brian Stansberry, Jean Deruelle

Field Summary
protected static org.jboss.logging.Logger logger
           
protected  javax.transaction.TransactionManager 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.service.session.JBossManager
activeCounter_, container_, createdCounter_, distributable_, expiredCounter_, invalidateSessionPolicy_, jvmRoute_, lifecycle_, log_, maxActive_, maxActiveCounter_, maxInactiveInterval_, objectName_, processingTime_, rejectedCounter_, replicationGranularity_, sessionIDGenerator_, sessionIdLength_, sessions_, started_, stats_, support_, timeSinceLastReset_, useLocalCache_
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
JBossCacheSipManager()
           
 
Method Summary
 void add(org.apache.catalina.Session session)
           
 void add(SipApplicationSession session)
           
 void add(SipSession session)
           
 void backgroundProcess()
          Overrides the superclass version to add a check as to whether we should do trace level logging.
protected  void clearSessions()
          Clear the underlying cache store and also pojo that has the observers.
protected  void clearSipApplicationSessions()
          Clear the underlying cache store and also pojo that has the observers.
 org.apache.catalina.Session createEmptySession()
           
 org.apache.catalina.Session createSession()
          Create a new session with a generated id.
 org.apache.catalina.Session createSession(java.lang.String sessionId)
          Create a new session.
 void dumpSipApplicationSessions()
           
 void dumpSipSessions()
           
protected  void endTransaction(java.lang.String id)
           
 void expireSession(java.lang.String sessionId)
           
 org.jboss.web.tomcat.service.session.ClusteredSession findLocalSession(java.lang.String realId)
          Returns the given session if it is being actively managed by this manager.
 org.jboss.web.tomcat.service.session.ClusteredSession[] findLocalSessions()
          Returns all the sessions that are being actively managed by this manager.
 ClusteredSipApplicationSession findLocalSipApplicationSession(SipApplicationSessionKey key, boolean create)
          Returns the given sip application session if it is being actively managed by this manager.
 ClusteredSipSession findLocalSipSession(SipSessionKey key, boolean create, MobicentsSipApplicationSession sipApplicationSessionImpl)
          Returns the given sip session if it is being actively managed by this manager.
 org.apache.catalina.Session findSession(java.lang.String id)
          Attempts to find the session in the collection of those being managed locally, and if not found there, in the distributed cache of sessions.
 org.apache.catalina.Session[] findSessions()
          Return the sessions.
 MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
          Retrieves the sip application session holding the converged http session in parameter
 java.lang.String getCacheObjectNameString()
          Gets a String representation of the JMX ObjectName under which our TreeCache is registered.
 org.jboss.web.tomcat.service.session.JBossCacheService getCacheService()
          Gets the JBossCacheService through which we interact with the TreeCache.
 org.apache.catalina.Container getContainer()
           
 java.lang.String getLastAccessedTime(java.lang.String sessionId)
           
protected  java.lang.String getRealId(java.lang.String id)
          Gets the session id with any jvmRoute removed.
 int getReplicationGranularity()
          Returns the replication granularity expressed as an int.
 java.lang.String getReplicationGranularityString()
          Gets the granularity of session data replicated across the cluster; i.e.
 java.lang.String getReplicationTriggerString()
          Gets the type of operations on a HttpSession that trigger replication.
 java.lang.Object getSessionAttribute(java.lang.String sessionId, java.lang.String key)
           
 java.lang.String getSessionAttributeString(java.lang.String sessionId, java.lang.String key)
           
 MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key, boolean create)
          Retrieve a sip application session from its key.
 SipFactoryImpl getSipFactoryImpl()
           
 MobicentsSipSession getSipSession(SipSessionKey key, boolean create, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession sipApplicationSessionImpl)
          Retrieve a sip session from its key.
 int getSnapshotInterval()
          Gets how often session changes should be replicated to other nodes.
 java.lang.String getSnapshotMode()
          Gets when sessions are replicated to the other nodes.
 boolean getUseJK()
          Gets whether the Engine in which we are running uses mod_jk.
protected  java.lang.ClassLoader getWebappClassLoader()
          Gets the classloader of the webapp we are managing.
 void init(java.lang.String name, org.jboss.metadata.WebMetaData webMetaData, boolean useJK, boolean useLocalCache)
          Initializes this Manager when running in embedded mode.
 java.lang.Boolean isReplicationFieldBatchMode()
          Gets whether, if replication granularity is set to FIELD, replication should be done in batch mode.
 java.lang.String listLocalSessionIds()
           
 java.lang.String listSessionIds()
           
protected  org.jboss.web.tomcat.service.session.ClusteredSession loadSession(java.lang.String realId)
          Loads a session from the distributed store.
protected  ClusteredSipApplicationSession loadSipApplicationSession(SipApplicationSessionKey key, boolean create)
          Loads a session from the distributed store.
protected  ClusteredSipSession loadSipSession(SipSessionKey key, boolean create, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession sipApplicationSessionImpl)
          Loads a session from the distributed store.
protected  void processExpires()
          Goes through all sessions and look if they have expired.
 void processLocalPojoModification(java.lang.String realId)
           
 void processRemoteAttributeRemoval(java.lang.String realId, java.lang.String attrKey)
           
 void processRemoteInvalidation(java.lang.String realId)
           
 void processRemoteSipApplicationSessionAttributeRemoval(java.lang.String realId, java.lang.String attrKey)
           
 void processRemoteSipApplicationSessionInvalidation(java.lang.String realId)
           
 void processRemoteSipSessionAttributeRemoval(java.lang.String realId, java.lang.String attrKey)
           
 void processRemoteSipSessionInvalidation(java.lang.String realId)
           
protected  void processSessionRepl(org.jboss.web.tomcat.service.session.ClusteredSession session)
          Places the current session contents in the distributed cache and replicates them to the cluster
 void processSipApplicationSessionLocalPojoModification(java.lang.String realId)
           
protected  void processSipApplicationSessionRepl(ClusteredSipApplicationSession session)
          Places the current session contents in the distributed cache and replicates them to the cluster
 void processSipSessionLocalPojoModification(java.lang.String realId)
           
protected  void processSipSessionRepl(ClusteredSipSession session)
          Places the current session contents in the distributed cache and replicates them to the cluster
 void remove(org.apache.catalina.Session session)
          Removes the session from this Manager's collection of actively managed sessions.
 void removeAllSessions()
          Remove the sip sessions and sip application sessions
 void removeLocal(org.apache.catalina.Session session)
          Removes the session from this Manager's collection of actively managed sessions.
 void removeLocal(SipApplicationSession session)
          Removes the session from this Manager's collection of actively managed sessions.
 void removeLocal(SipSession session)
          Removes the session from this Manager's collection of actively managed sessions.
 MobicentsSipApplicationSession removeSipApplicationSession(SipApplicationSessionKey key)
          Removes a sip application session from the manager by its key
 MobicentsSipSession removeSipSession(SipSessionKey key)
          Removes a sip session from the manager by its key
 void setCacheObjectNameString(java.lang.String treeCacheObjectName)
          Sets the JMX ObjectName under which our TreeCache is registered.
 void setContainer(org.apache.catalina.Container container)
           
 void setReplicationFieldBatchMode(boolean replicationFieldBatchMode)
          Sets whether, if replication granularity is set to FIELD, replication should be done in batch mode.
 void setReplicationGranularityString(java.lang.String granularity)
          Sets the granularity of session data replicated across the cluster.
 void setReplicationTriggerString(java.lang.String trigger)
          Sets the type of operations on a HttpSession that trigger replication.
 void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
           
 void setSnapshotInterval(int snapshotInterval)
          Sets how often session changes should be replicated to other nodes.
 void setSnapshotMode(java.lang.String snapshotMode)
          Sets when sessions are replicated to the other nodes.
 void setUseJK(boolean useJK)
          Sets whether the Engine in which we are running uses mod_jk.
 void setUseLocalCache(boolean useLocalCache)
           
 void start()
          Start this Manager
 void stop()
           
 boolean storeSession(org.apache.catalina.Session baseSession)
           
 boolean storeSipApplicationSession(SipApplicationSession baseSession)
           
 boolean storeSipSession(SipSession baseSession)
           
protected  void unloadedSessionChanged(java.lang.String realId, java.lang.String dataOwner)
          Callback from the CacheListener to notify us that a session we haven't loaded has been changed.
protected  void unloadedSipApplicationSessionChanged(java.lang.String realId, java.lang.String dataOwner)
          Callback from the CacheListener to notify us that a session we haven't loaded has been changed.
protected  void unloadedSipSessionChanged(java.lang.String realId, java.lang.String dataOwner)
          Callback from the CacheListener to notify us that a session we haven't loaded has been changed.
 
Methods inherited from class org.jboss.web.tomcat.service.session.JBossManager
addLifecycleListener, addPropertyChangeListener, findLifecycleListeners, getActiveSessionCount, getActiveSessions, getCreatedSessionCount, getDistributable, getEngine, getExpiredSessionCount, getExpiredSessions, getInfo, getInvalidateSessionPolicy, getJvmRoute, getMaxActive, getMaxActiveAllowed, getMaxActiveSessionCount, getMaxInactiveInterval, getNextId, getObjectName, getProcessingTime, getRejectedSessionCount, getRejectedSessions, getReplicationStatistics, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, isUseLocalCache, load, propertyChange, removeLifecycleListener, removePropertyChangeListener, reportReplicationStatistics, reportReplicationStatisticsCSV, reportReplicationStatisticsCSV, resetStats, setDistributable, setExpiredSessions, setMaxActive, setMaxActiveAllowed, 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
 
Methods inherited from interface org.apache.catalina.Manager
addPropertyChangeListener, getActiveSessions, getDistributable, getExpiredSessions, getInfo, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, load, removePropertyChangeListener, setDistributable, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setRejectedSessions, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, unload
 
Methods inherited from interface org.jboss.web.tomcat.service.session.JBossManagerMBean
getActiveSessionCount, getCreatedSessionCount, getDistributable, getExpiredSessionCount, getMaxActiveAllowed, getMaxActiveSessionCount, getMaxInactiveInterval, getProcessingTime, getRejectedSessionCount, getReplicationStatistics, getSessionIdLength, reportReplicationStatistics, reportReplicationStatisticsCSV, reportReplicationStatisticsCSV, resetStats, setMaxActiveAllowed, setMaxInactiveInterval, timeInSecondsSinceLastReset
 

Field Detail

logger

protected static org.jboss.logging.Logger logger

tm

protected javax.transaction.TransactionManager tm
The transaction manager.


useJK_

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

Constructor Detail

JBossCacheSipManager

public JBossCacheSipManager()
Method Detail

init

public void init(java.lang.String name,
                 org.jboss.metadata.WebMetaData webMetaData,
                 boolean useJK,
                 boolean useLocalCache)
          throws org.jboss.web.tomcat.service.session.ClusteringNotSupportedException
Initializes this Manager when running in embedded mode.

NOTE: This method should not be called when running unembedded.

Specified by:
init in interface org.jboss.web.tomcat.service.session.AbstractJBossManager
Overrides:
init in class org.jboss.web.tomcat.service.session.JBossCacheManager
Throws:
org.jboss.web.tomcat.service.session.ClusteringNotSupportedException

getCacheService

public org.jboss.web.tomcat.service.session.JBossCacheService getCacheService()
Gets the JBossCacheService through which we interact with the TreeCache.

Overrides:
getCacheService in class org.jboss.web.tomcat.service.session.JBossCacheManager

getCacheObjectNameString

public java.lang.String getCacheObjectNameString()
Gets a String representation of the JMX ObjectName under which our TreeCache is registered.

Specified by:
getCacheObjectNameString in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getCacheObjectNameString in class org.jboss.web.tomcat.service.session.JBossCacheManager

setCacheObjectNameString

public void setCacheObjectNameString(java.lang.String treeCacheObjectName)
Sets the JMX ObjectName under which our TreeCache is registered.

Overrides:
setCacheObjectNameString in class org.jboss.web.tomcat.service.session.JBossCacheManager

getSnapshotMode

public java.lang.String getSnapshotMode()
Gets when sessions are replicated to the other nodes. The default value, "instant", synchronously replicates changes to the other nodes. In this case, the "SnapshotInterval" attribute is not used. The "interval" mode, in association with the "SnapshotInterval" attribute, indicates that Tomcat will only replicate modified sessions every "SnapshotInterval" miliseconds at most.

Specified by:
getSnapshotMode in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getSnapshotMode in class org.jboss.web.tomcat.service.session.JBossCacheManager
See Also:
getSnapshotInterval()

setSnapshotMode

public void setSnapshotMode(java.lang.String snapshotMode)
Sets when sessions are replicated to the other nodes. Valid values are:

Overrides:
setSnapshotMode in class org.jboss.web.tomcat.service.session.JBossCacheManager

getSnapshotInterval

public int getSnapshotInterval()
Gets how often session changes should be replicated to other nodes. Only relevant if property snapshotMode is set to interval.

Specified by:
getSnapshotInterval in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getSnapshotInterval in class org.jboss.web.tomcat.service.session.JBossCacheManager
Returns:
the number of milliseconds between session replications.

setSnapshotInterval

public void setSnapshotInterval(int snapshotInterval)
Sets how often session changes should be replicated to other nodes.

Overrides:
setSnapshotInterval in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
snapshotInterval - the number of milliseconds between session replications.

getUseJK

public boolean getUseJK()
Gets whether the Engine in which we are running uses mod_jk.

Specified by:
getUseJK in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getUseJK in class org.jboss.web.tomcat.service.session.JBossCacheManager

setUseJK

public void setUseJK(boolean useJK)
Sets whether the Engine in which we are running uses mod_jk.

Overrides:
setUseJK in class org.jboss.web.tomcat.service.session.JBossCacheManager

getReplicationGranularity

public int getReplicationGranularity()
Returns the replication granularity expressed as an int.

Overrides:
getReplicationGranularity in class org.jboss.web.tomcat.service.session.JBossCacheManager
See Also:
WebMetaData.REPLICATION_GRANULARITY_ATTRIBUTE, WebMetaData.REPLICATION_GRANULARITY_FIELD, WebMetaData.REPLICATION_GRANULARITY_SESSION

getReplicationGranularityString

public java.lang.String getReplicationGranularityString()
Gets the granularity of session data replicated across the cluster; i.e. whether the entire session should be replicated when replication is triggered, only modified attributes, or only modified fields of attributes.

Specified by:
getReplicationGranularityString in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getReplicationGranularityString in class org.jboss.web.tomcat.service.session.JBossCacheManager

setReplicationGranularityString

public void setReplicationGranularityString(java.lang.String granularity)
Sets the granularity of session data replicated across the cluster. Valid values are:

Overrides:
setReplicationGranularityString in class org.jboss.web.tomcat.service.session.JBossCacheManager

getReplicationTriggerString

public java.lang.String getReplicationTriggerString()
Gets the type of operations on a HttpSession that trigger replication.

Specified by:
getReplicationTriggerString in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getReplicationTriggerString in class org.jboss.web.tomcat.service.session.JBossCacheManager

setReplicationTriggerString

public void setReplicationTriggerString(java.lang.String trigger)
Sets the type of operations on a HttpSession that trigger replication. Valid values are:

Overrides:
setReplicationTriggerString in class org.jboss.web.tomcat.service.session.JBossCacheManager

isReplicationFieldBatchMode

public java.lang.Boolean isReplicationFieldBatchMode()
Gets whether, if replication granularity is set to FIELD, replication should be done in batch mode. Ignored if field-level granularity is not used.

Specified by:
isReplicationFieldBatchMode in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
isReplicationFieldBatchMode in class org.jboss.web.tomcat.service.session.JBossCacheManager

setReplicationFieldBatchMode

public void setReplicationFieldBatchMode(boolean replicationFieldBatchMode)
Sets whether, if replication granularity is set to FIELD, replication should be done in batch mode. Ignored if field-level granularity is not used.

Overrides:
setReplicationFieldBatchMode in class org.jboss.web.tomcat.service.session.JBossCacheManager

setUseLocalCache

public void setUseLocalCache(boolean useLocalCache)
Overrides:
setUseLocalCache in class org.jboss.web.tomcat.service.session.JBossCacheManager

expireSession

public void expireSession(java.lang.String sessionId)
Specified by:
expireSession in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
expireSession in class org.jboss.web.tomcat.service.session.JBossCacheManager

getLastAccessedTime

public java.lang.String getLastAccessedTime(java.lang.String sessionId)
Specified by:
getLastAccessedTime in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getLastAccessedTime in class org.jboss.web.tomcat.service.session.JBossCacheManager

getSessionAttribute

public java.lang.Object getSessionAttribute(java.lang.String sessionId,
                                            java.lang.String key)
Specified by:
getSessionAttribute in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getSessionAttribute in class org.jboss.web.tomcat.service.session.JBossCacheManager

getSessionAttributeString

public java.lang.String getSessionAttributeString(java.lang.String sessionId,
                                                  java.lang.String key)
Specified by:
getSessionAttributeString in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
getSessionAttributeString in class org.jboss.web.tomcat.service.session.JBossCacheManager

listLocalSessionIds

public java.lang.String listLocalSessionIds()
Specified by:
listLocalSessionIds in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
listLocalSessionIds in class org.jboss.web.tomcat.service.session.JBossCacheManager

listSessionIds

public java.lang.String listSessionIds()
Specified by:
listSessionIds in interface org.jboss.web.tomcat.service.session.JBossCacheManagerMBean
Overrides:
listSessionIds in class org.jboss.web.tomcat.service.session.JBossCacheManager

start

public void start()
           throws org.apache.catalina.LifecycleException
Start this Manager

Specified by:
start in interface org.apache.catalina.Lifecycle
Overrides:
start in class org.jboss.web.tomcat.service.session.JBossCacheManager
Throws:
org.apache.catalina.LifecycleException

stop

public void stop()
          throws org.apache.catalina.LifecycleException
Specified by:
stop in interface org.apache.catalina.Lifecycle
Overrides:
stop in class org.jboss.web.tomcat.service.session.JBossCacheManager
Throws:
org.apache.catalina.LifecycleException

clearSessions

protected void clearSessions()
Clear the underlying cache store and also pojo that has the observers.

Overrides:
clearSessions in class org.jboss.web.tomcat.service.session.JBossCacheManager

clearSipApplicationSessions

protected void clearSipApplicationSessions()
Clear the underlying cache store and also pojo that has the observers.


createSession

public org.apache.catalina.Session createSession()
Create a new session with a generated id.

Specified by:
createSession in interface org.apache.catalina.Manager
Overrides:
createSession in class org.jboss.web.tomcat.service.session.JBossCacheManager

createSession

public org.apache.catalina.Session createSession(java.lang.String sessionId)
Create a new session.

Specified by:
createSession in interface org.apache.catalina.Manager
Overrides:
createSession in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
sessionId - the id to use, or null if we should generate a new id
Returns:
the session
Throws:
java.lang.IllegalStateException - if the current number of active sessions exceeds the maximum number allowed

storeSession

public boolean storeSession(org.apache.catalina.Session baseSession)
Specified by:
storeSession in interface org.jboss.web.tomcat.service.session.AbstractJBossManager
Overrides:
storeSession in class org.jboss.web.tomcat.service.session.JBossCacheManager

storeSipSession

public boolean storeSipSession(SipSession baseSession)

storeSipApplicationSession

public boolean storeSipApplicationSession(SipApplicationSession baseSession)

add

public void add(org.apache.catalina.Session session)
Specified by:
add in interface org.apache.catalina.Manager
Overrides:
add in class org.jboss.web.tomcat.service.session.JBossCacheManager

add

public void add(SipSession session)

add

public void add(SipApplicationSession session)

findSession

public org.apache.catalina.Session findSession(java.lang.String id)
Attempts to find the session in the collection of those being managed locally, and if not found there, in the distributed cache of sessions.

If a session is found in the distributed cache, it is added to the collection of those being managed locally.

Specified by:
findSession in interface org.apache.catalina.Manager
Overrides:
findSession in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
id - the session id, which may include an appended jvmRoute
Returns:
the session, or null if no such session could be found

findSessions

public org.apache.catalina.Session[] findSessions()
Return the sessions. Note that this will return not only the local in-memory sessions, but also any sessions that are in the distributed cache but have not previously been accessed on this server. Invoking this method will bring all such sessions into local memory and can potentially be quite expensive.

Note also that when sessions are loaded from the distributed cache, no check is made as to whether the number of local sessions will thereafter exceed the maximum number allowed on this server.

Specified by:
findSessions in interface org.apache.catalina.Manager
Overrides:
findSessions in class org.jboss.web.tomcat.service.session.JBossCacheManager
Returns:
an array of all the sessions

findLocalSessions

public org.jboss.web.tomcat.service.session.ClusteredSession[] findLocalSessions()
Returns all the sessions that are being actively managed by this manager. This includes those that were created on this server, those that were brought into local management by a call to findLocalSession(String) as well as all sessions brought into local management by a call to findSessions().

Overrides:
findLocalSessions in class org.jboss.web.tomcat.service.session.JBossCacheManager

findLocalSession

public org.jboss.web.tomcat.service.session.ClusteredSession findLocalSession(java.lang.String realId)
Returns the given session if it is being actively managed by this manager. An actively managed session is on that was either created on this server, brought into local management by a call to findLocalSession(String) or brought into local management by a call to findSessions().

Overrides:
findLocalSession in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
realId - the session id, with any trailing jvmRoute removed.
See Also:
getRealId(String)

findLocalSipSession

public ClusteredSipSession findLocalSipSession(SipSessionKey key,
                                               boolean create,
                                               MobicentsSipApplicationSession sipApplicationSessionImpl)
Returns the given sip session if it is being actively managed by this manager. An actively managed sip session is on that was either created on this server, brought into local management by a call to #findLocalSipSession(String) or brought into local management by a call to #findSipSessions().

Parameters:
key - the session key, with any trailing jvmRoute removed.

findLocalSipApplicationSession

public ClusteredSipApplicationSession findLocalSipApplicationSession(SipApplicationSessionKey key,
                                                                     boolean create)
Returns the given sip application session if it is being actively managed by this manager. An actively managed sip application session is on that was either created on this server, brought into local management by a call to #findLocalSipApplicationSession(String) or brought into local management by a call to #findSipApplicationSessions().

Parameters:
key - the session key, with any trailing jvmRoute removed.

remove

public void remove(org.apache.catalina.Session session)
Removes the session from this Manager's collection of actively managed sessions. Also removes the session from the distributed cache, both on this server and on all other server to which this one replicates.

Specified by:
remove in interface org.apache.catalina.Manager
Overrides:
remove in class org.jboss.web.tomcat.service.session.JBossCacheManager

removeLocal

public void removeLocal(org.apache.catalina.Session session)
Removes the session from this Manager's collection of actively managed sessions. Also removes the session from this server's copy of the distributed cache (but does not remove it from other servers' distributed cache).

Specified by:
removeLocal in interface org.jboss.web.tomcat.service.session.AbstractJBossManager
Overrides:
removeLocal in class org.jboss.web.tomcat.service.session.JBossCacheManager

removeLocal

public void removeLocal(SipSession session)
Removes the session from this Manager's collection of actively managed sessions. Also removes the session from this server's copy of the distributed cache (but does not remove it from other servers' distributed cache).


removeLocal

public void removeLocal(SipApplicationSession session)
Removes the session from this Manager's collection of actively managed sessions. Also removes the session from this server's copy of the distributed cache (but does not remove it from other servers' distributed cache).


loadSession

protected org.jboss.web.tomcat.service.session.ClusteredSession loadSession(java.lang.String realId)
Loads a session from the distributed store. If an existing session with the id is already under local management, that session's internal state will be updated from the distributed store. Otherwise a new session will be created and added to the collection of those sessions under local management.

Overrides:
loadSession in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
realId - id of the session-id with any jvmRoute removed
Returns:
the session or null if the session cannot be found in the distributed store TODO refactor this into 2 overloaded methods -- one that takes a ClusteredSession and populates it and one that takes an id, creates the session and calls the first

loadSipSession

protected ClusteredSipSession loadSipSession(SipSessionKey key,
                                             boolean create,
                                             SipFactoryImpl sipFactoryImpl,
                                             MobicentsSipApplicationSession sipApplicationSessionImpl)
Loads a session from the distributed store. If an existing session with the id is already under local management, that session's internal state will be updated from the distributed store. Otherwise a new session will be created and added to the collection of those sessions under local management.

Parameters:
realId - id of the session-id with any jvmRoute removed
Returns:
the session or null if the session cannot be found in the distributed store TODO refactor this into 2 overloaded methods -- one that takes a ClusteredSession and populates it and one that takes an id, creates the session and calls the first

loadSipApplicationSession

protected ClusteredSipApplicationSession loadSipApplicationSession(SipApplicationSessionKey key,
                                                                   boolean create)
Loads a session from the distributed store. If an existing session with the id is already under local management, that session's internal state will be updated from the distributed store. Otherwise a new session will be created and added to the collection of those sessions under local management.

Parameters:
realId - id of the session-id with any jvmRoute removed
Returns:
the session or null if the session cannot be found in the distributed store TODO refactor this into 2 overloaded methods -- one that takes a ClusteredSession and populates it and one that takes an id, creates the session and calls the first

processSessionRepl

protected void processSessionRepl(org.jboss.web.tomcat.service.session.ClusteredSession session)
Places the current session contents in the distributed cache and replicates them to the cluster

Overrides:
processSessionRepl in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
session - the session. Cannot be null.

processSipSessionRepl

protected void processSipSessionRepl(ClusteredSipSession session)
Places the current session contents in the distributed cache and replicates them to the cluster

Parameters:
session - the session. Cannot be null.

processSipApplicationSessionRepl

protected void processSipApplicationSessionRepl(ClusteredSipApplicationSession session)
Places the current session contents in the distributed cache and replicates them to the cluster

Parameters:
session - the session. Cannot be null.

endTransaction

protected void endTransaction(java.lang.String id)
Overrides:
endTransaction in class org.jboss.web.tomcat.service.session.JBossCacheManager

getWebappClassLoader

protected java.lang.ClassLoader getWebappClassLoader()
Gets the classloader of the webapp we are managing.

Overrides:
getWebappClassLoader in class org.jboss.web.tomcat.service.session.JBossCacheManager

backgroundProcess

public void backgroundProcess()
Overrides the superclass version to add a check as to whether we should do trace level logging.

Specified by:
backgroundProcess in interface org.apache.catalina.Manager
Overrides:
backgroundProcess in class org.jboss.web.tomcat.service.session.JBossCacheManager

processExpires

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

Overrides:
processExpires in class org.jboss.web.tomcat.service.session.JBossCacheManager

processRemoteAttributeRemoval

public void processRemoteAttributeRemoval(java.lang.String realId,
                                          java.lang.String attrKey)
Overrides:
processRemoteAttributeRemoval in class org.jboss.web.tomcat.service.session.JBossCacheManager

processRemoteSipApplicationSessionAttributeRemoval

public void processRemoteSipApplicationSessionAttributeRemoval(java.lang.String realId,
                                                               java.lang.String attrKey)

processRemoteSipSessionAttributeRemoval

public void processRemoteSipSessionAttributeRemoval(java.lang.String realId,
                                                    java.lang.String attrKey)

processRemoteInvalidation

public void processRemoteInvalidation(java.lang.String realId)
Overrides:
processRemoteInvalidation in class org.jboss.web.tomcat.service.session.JBossCacheManager

processRemoteSipApplicationSessionInvalidation

public void processRemoteSipApplicationSessionInvalidation(java.lang.String realId)

processRemoteSipSessionInvalidation

public void processRemoteSipSessionInvalidation(java.lang.String realId)

processLocalPojoModification

public void processLocalPojoModification(java.lang.String realId)
Overrides:
processLocalPojoModification in class org.jboss.web.tomcat.service.session.JBossCacheManager

processSipApplicationSessionLocalPojoModification

public void processSipApplicationSessionLocalPojoModification(java.lang.String realId)

processSipSessionLocalPojoModification

public void processSipSessionLocalPojoModification(java.lang.String realId)

getRealId

protected java.lang.String getRealId(java.lang.String id)
Gets the session id with any jvmRoute removed.

Overrides:
getRealId in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
id - a session id with or without an appended jvmRoute. Cannot be null.

unloadedSessionChanged

protected void unloadedSessionChanged(java.lang.String realId,
                                      java.lang.String dataOwner)
Callback from the CacheListener to notify us that a session we haven't loaded has been changed.

Overrides:
unloadedSessionChanged in class org.jboss.web.tomcat.service.session.JBossCacheManager
Parameters:
realId - the session id, without any trailing jvmRoute
dataOwner - the owner of the session. Can be null if the owner is unknown.

unloadedSipSessionChanged

protected void unloadedSipSessionChanged(java.lang.String realId,
                                         java.lang.String dataOwner)
Callback from the CacheListener to notify us that a session we haven't loaded has been changed.

Parameters:
realId - the session id, without any trailing jvmRoute
dataOwner - the owner of the session. Can be null if the owner is unknown.

unloadedSipApplicationSessionChanged

protected void unloadedSipApplicationSessionChanged(java.lang.String realId,
                                                    java.lang.String dataOwner)
Callback from the CacheListener to notify us that a session we haven't loaded has been changed.

Parameters:
realId - the session id, without any trailing jvmRoute
dataOwner - the owner of the session. Can be null if the owner is unknown.

createEmptySession

public org.apache.catalina.Session createEmptySession()
Specified by:
createEmptySession in interface org.apache.catalina.Manager
Overrides:
createEmptySession in class org.jboss.web.tomcat.service.session.JBossCacheManager

getSipFactoryImpl

public SipFactoryImpl getSipFactoryImpl()
Specified by:
getSipFactoryImpl in interface SipManager
Returns:
the SipFactoryImpl

setSipFactoryImpl

public void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
Specified by:
setSipFactoryImpl in interface SipManager
Parameters:
sipFactoryImpl - the SipFactoryImpl to set

getContainer

public org.apache.catalina.Container getContainer()
Specified by:
getContainer in interface org.apache.catalina.Manager
Overrides:
getContainer in class org.jboss.web.tomcat.service.session.JBossManager
Returns:
the container

setContainer

public void setContainer(org.apache.catalina.Container container)
Specified by:
setContainer in interface org.apache.catalina.Manager
Overrides:
setContainer in class org.jboss.web.tomcat.service.session.JBossManager
Parameters:
container - the container to set

removeSipSession

public MobicentsSipSession removeSipSession(SipSessionKey key)
Removes a sip session from the manager by its key

Specified by:
removeSipSession in interface SipManager
Parameters:
key - the identifier for this session
Returns:
the sip session that had just been removed, null otherwise

removeSipApplicationSession

public MobicentsSipApplicationSession removeSipApplicationSession(SipApplicationSessionKey key)
Removes a sip application session from the manager by its key

Specified by:
removeSipApplicationSession in interface SipManager
Parameters:
key - the identifier for this session
Returns:
the sip application session that had just been removed, null otherwise

getSipApplicationSession

public MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key,
                                                               boolean create)
Retrieve a sip application session from its key. If none exists, one can enforce the creation through the create parameter to true.

Specified by:
getSipApplicationSession in interface SipManager
Parameters:
key - the key identifying the sip application session to retrieve
create - if set to true, if no session has been found one will be created
Returns:
the sip application session matching the key

getSipSession

public MobicentsSipSession getSipSession(SipSessionKey key,
                                         boolean create,
                                         SipFactoryImpl sipFactoryImpl,
                                         MobicentsSipApplicationSession sipApplicationSessionImpl)
Retrieve a sip session from its key. If none exists, one can enforce the creation through the create parameter to true. the sip factory cannot be null if create is set to true.

Specified by:
getSipSession in interface SipManager
Parameters:
key - the key identifying the sip session to retrieve
create - if set to true, if no session has been found one will be created
sipFactoryImpl - needed only for sip session creation.
sipApplicationSessionImpl - to associate the SipSession with if create is set to true, if false it won't be used
Returns:
the sip session matching the key

findSipApplicationSession

public MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
Retrieves the sip application session holding the converged http session in parameter

Specified by:
findSipApplicationSession in interface SipManager
Returns:
the sip application session holding a reference to it or null if none references it

dumpSipSessions

public void dumpSipSessions()
Specified by:
dumpSipSessions in interface SipManager

dumpSipApplicationSessions

public void dumpSipApplicationSessions()
Specified by:
dumpSipApplicationSessions in interface SipManager

removeAllSessions

public void removeAllSessions()
Remove the sip sessions and sip application sessions

Specified by:
removeAllSessions in interface SipManager


Copyright © 2008. All Rights Reserved.