Package org.wso2.carbon.webapp.mgt
Class CarbonTomcatSessionPersistentManager
java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.session.ManagerBase
org.apache.catalina.session.PersistentManagerBase
org.wso2.carbon.webapp.mgt.CarbonTomcatSessionPersistentManager
- All Implemented Interfaces:
MBeanRegistration,org.apache.catalina.DistributedManager,org.apache.catalina.JmxEnabled,org.apache.catalina.Lifecycle,org.apache.catalina.Manager,org.apache.catalina.StoreManager
public class CarbonTomcatSessionPersistentManager
extends org.apache.catalina.session.PersistentManagerBase
CarbonTomcatSessionPersistentManager which ensures that one tenant's sessions cannot be accessed
by other tenants. Super tenant should be able to access all sessions
PersistentManager has the capability to swap active (but idle) sessions out to a persistent
storage mechanism, as well as to save all sessions across a normal restart of Tomcat.
The actual persistent storage mechanism used is selected by your choice of a
Store element nested inside the Manager element - this is required for use of PersistentManager.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.catalina.session.ManagerBase
org.apache.catalina.session.ManagerBase.SessionTimingNested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
org.apache.catalina.Lifecycle.SingleUse -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe descriptive name of this Manager implementation (for logging).Fields inherited from class org.apache.catalina.session.PersistentManagerBase
maxIdleBackup, maxIdleSwap, minIdleSwap, saveOnRestart, storeFields inherited from class org.apache.catalina.session.ManagerBase
duplicates, expiredSessions, maxActive, maxActiveSessions, processExpiresFrequency, processingTime, rejectedSessions, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdGenerator, sessionIdGeneratorClass, sessionMaxAliveTime, sessions, sm, support, TIMING_STATS_CACHE_SIZEFields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserverFields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.catalina.SessionfindSession(String id) Return the active Session, associated with this Manager, with the specified session id (if any); otherwise returnnull.org.apache.catalina.Session[]Return the set of active Sessions associated with this Manager.intReturns the number of active sessionslongGets the number of sessions that have expired.intMax number of concurrent active sessionsgetName()Return the descriptive short name of this Manager implementation.intReturns the number of session creations that failed due to maxActiveSessionsintGets the average time (in seconds) that expired sessions had been alive.voidsetOwnerTenantId(int ownerTenantId) Sets the tenantID of the tenant who owns this Tomcat Session ManagervoidsetSessionMaxAliveTime(int sessionMaxAliveTime) Sets the longest time (in seconds) that an expired session had been alive.Methods inherited from class org.apache.catalina.session.PersistentManagerBase
clearStore, getActiveSessionsFull, getMaxIdleBackup, getMaxIdleSwap, getMinIdleSwap, getSaveOnRestart, getSessionIdsFull, getStore, isLoaded, load, processExpires, processMaxActiveSwaps, processMaxIdleBackups, processMaxIdleSwaps, processPersistenceChecks, remove, removeSession, removeSuper, setMaxIdleBackup, setMaxIdleSwap, setMinIdleSwap, setSaveOnRestart, setStore, startInternal, stopInternal, swapIn, swapOut, unload, writeSessionMethods inherited from class org.apache.catalina.session.ManagerBase
add, addPropertyChangeListener, backgroundProcess, changeSessionId, changeSessionId, changeSessionId, createEmptySession, createSession, expireSession, generateSessionId, getClassName, getContext, getCreationTime, getCreationTimestamp, getDomainInternal, getDuplicates, getEngine, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActiveSessions, getNewSession, getNotifyAttributeListenerOnUnchangedValue, getNotifyBindingListenerOnUnchangedValue, getObjectNameKeyProperties, getPersistAuthentication, getProcessExpiresFrequency, getProcessingTime, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, getSession, getSessionAttribute, getSessionAttributeNameFilter, getSessionAttributeNamePattern, getSessionAttributeValueClassNameFilter, getSessionAttributeValueClassNamePattern, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionMaxAliveTime, getThisAccessedTime, getThisAccessedTimestamp, getWarnOnSessionAttributeFilterFailure, initInternal, listSessionIds, remove, removePropertyChangeListener, rotateSessionId, setContext, setDuplicates, setExpiredSessions, setMaxActive, setMaxActiveSessions, setNotifyAttributeListenerOnUnchangedValue, setNotifyBindingListenerOnUnchangedValue, setPersistAuthentication, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionAttributeNameFilter, setSessionAttributeValueClassNameFilter, setSessionCounter, setSessionIdGenerator, setWarnOnSessionAttributeFilterFailure, toString, updateSessionMaxAliveTime, willAttributeDistributeMethods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregisterMethods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
Field Details
-
name
The descriptive name of this Manager implementation (for logging).- See Also:
-
-
Constructor Details
-
CarbonTomcatSessionPersistentManager
public CarbonTomcatSessionPersistentManager() -
CarbonTomcatSessionPersistentManager
public CarbonTomcatSessionPersistentManager(int ownerTenantId)
-
-
Method Details
-
getName
Return the descriptive short name of this Manager implementation.- Overrides:
getNamein classorg.apache.catalina.session.PersistentManagerBase
-
getMaxActive
public int getMaxActive()Max number of concurrent active sessions- Specified by:
getMaxActivein interfaceorg.apache.catalina.Manager- Overrides:
getMaxActivein classorg.apache.catalina.session.ManagerBase- Returns:
- The highest number of concurrent active sessions
-
getActiveSessions
public int getActiveSessions()Returns the number of active sessions- Specified by:
getActiveSessionsin interfaceorg.apache.catalina.Manager- Overrides:
getActiveSessionsin classorg.apache.catalina.session.ManagerBase- Returns:
- number of sessions active
-
getExpiredSessions
public long getExpiredSessions()Gets the number of sessions that have expired.- Specified by:
getExpiredSessionsin interfaceorg.apache.catalina.Manager- Overrides:
getExpiredSessionsin classorg.apache.catalina.session.ManagerBase- Returns:
- Number of sessions that have expired
-
getRejectedSessions
public int getRejectedSessions()Returns the number of session creations that failed due to maxActiveSessions- Specified by:
getRejectedSessionsin interfaceorg.apache.catalina.Manager- Overrides:
getRejectedSessionsin classorg.apache.catalina.session.ManagerBase- Returns:
- rejected count
-
setSessionMaxAliveTime
public void setSessionMaxAliveTime(int sessionMaxAliveTime) Sets the longest time (in seconds) that an expired session had been alive.- Specified by:
setSessionMaxAliveTimein interfaceorg.apache.catalina.Manager- Overrides:
setSessionMaxAliveTimein classorg.apache.catalina.session.ManagerBase- Parameters:
sessionMaxAliveTime- sessionMaxAliveTime Longest time (in seconds) that an expired session had been alive.
-
getSessionAverageAliveTime
public int getSessionAverageAliveTime()Gets the average time (in seconds) that expired sessions had been alive.- Specified by:
getSessionAverageAliveTimein interfaceorg.apache.catalina.Manager- Overrides:
getSessionAverageAliveTimein classorg.apache.catalina.session.ManagerBase- Returns:
- Average time (in seconds) that expired sessions had been alive.
-
findSessions
public org.apache.catalina.Session[] findSessions()Return the set of active Sessions associated with this Manager. If this Manager has no active Sessions, a zero-length array is returned.- Specified by:
findSessionsin interfaceorg.apache.catalina.Manager- Overrides:
findSessionsin classorg.apache.catalina.session.ManagerBase- Returns:
- Session objects associated with this Manager as a result set
-
findSession
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise returnnull.- Specified by:
findSessionin interfaceorg.apache.catalina.Manager- Overrides:
findSessionin classorg.apache.catalina.session.PersistentManagerBase- Parameters:
id- The session id for the session to be returned- Returns:
- associated session
- Throws:
IOException- if an input/output error occurs while processing this requestIllegalStateException- if a new session cannot be instantiated for any reason
-
setOwnerTenantId
public void setOwnerTenantId(int ownerTenantId) Sets the tenantID of the tenant who owns this Tomcat Session Manager- Parameters:
ownerTenantId- Relevant tenantID which is associated to CarbonTomcatSessionPersistentManager
-