public class DistributableSessionManager<O extends OutgoingDistributableSessionData> extends AbstractSessionManager implements LocalDistributableSessionManager, ClusteredSessionManager<O>, DistributableSessionManagerMBean, org.apache.catalina.LifecycleListener
averageAliveTime, createdCounter, duplicates, expiredCounter, lifecycle, localActiveCounter, maxActiveAllowed, maxActiveCounter, maxAliveTime, maxLocalActiveCounter, processingTime, rejectedCounter, started, timeSinceLastResetcontainer, distributable, domain, expiredSessions, initialized, log, maxActive, maxInactiveInterval, mserver, oname, processExpiresFrequency, sessionAverageAliveTime, sessionCounter, sessionIdLength, sessionMaxAliveTime, sessions, sm, support| Constructor and Description |
|---|
DistributableSessionManager(DistributedCacheManagerFactory factory,
org.apache.catalina.Context context,
org.jboss.metadata.web.jboss.JBossWebMetaData metaData,
org.jboss.marshalling.ClassResolver resolver) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.apache.catalina.Session session) |
protected boolean |
appendJVMRoute() |
protected ClusteredSessionNotificationPolicy |
createClusteredSessionNotificationPolicy() |
ClusteredSession<O> |
createEmptySession() |
org.apache.catalina.Session |
createSession(String sessionId,
Random random) |
String |
createSessionId(String realId,
String jvmRoute) |
protected SnapshotManager |
createSnapshotManager() |
ClusteredSession<O> |
findSession(String id) |
org.apache.catalina.Session[] |
findSessions() |
org.jboss.marshalling.ClassResolver |
getApplicationClassResolver()
Get the classloader able to load application classes.
|
String |
getCacheConfigName()
Gets the cache config name used to get the underlying cache from a cache manager.
|
String |
getContextName() |
DistributedCacheManager<O> |
getDistributedCacheManager()
Gets the
DistributedCacheManager through which we interact with the distributed cache. |
String |
getEngineName()
Returns the name of the session manager's engine.
|
String |
getHostName() |
String |
getInfo() |
long |
getMaxPassivatedSessionCount()
Gets the highest number of passivated sessions seen.
|
int |
getMaxUnreplicatedInterval()
Get the maximum interval between requests, in seconds, after which a request will trigger replication of the session's
metadata regardless of whether the request has otherwise made the session dirty.
|
String |
getName()
Returns the unique name of this session manager.
|
ClusteredSessionNotificationPolicy |
getNotificationPolicy()
Gets the policy for determining whether the servlet spec notifications related to session events are allowed to be
emitted on the local cluster node.
|
long |
getPassivatedSessionCount()
Gets the number of passivated sessions
|
long |
getPassivationMaxIdleTime()
Elapsed time after which an inactive session will be passivated to persistent storage if
passivation is enabled. |
long |
getPassivationMinIdleTime()
Elapsed time after which an inactive session will be passivated to persistent storage if
passivation is enabled and the manager needs to passivate sessions early in order to comply with a
SessionManagerMBean.getMaxActiveAllowed() setting. |
org.jboss.metadata.web.jboss.ReplicationConfig |
getReplicationConfig()
Gets the web application metadata.
|
org.jboss.metadata.web.jboss.ReplicationGranularity |
getReplicationGranularity()
Gets the replication granularity.
|
org.jboss.metadata.web.jboss.ReplicationTrigger |
getReplicationTrigger()
Gets the policy controlling whether session attribute reads and writes mark the session/attribute as needing replication.
|
int |
getSnapshotInterval()
Gets the number of milliseconds between replications if "interval" mode is used.
|
org.jboss.metadata.web.jboss.SnapshotMode |
getSnapshotMode()
Gets the snapshot mode.
|
protected int |
getTotalActiveSessions()
Get the total number of active sessions
|
boolean |
getUseJK()
Gets whether JK is being used and special handling of a jvmRoute portion of session ids is needed.
|
protected void |
initializeUnloadedSessions()
Gets the ids of all sessions in the distributed cache and adds them to the unloaded sessions map, along with their
lastAccessedTime and their maxInactiveInterval.
|
protected void |
installValves()
Instantiate a SnapshotManager and ClusteredSessionValve and add the valve to our parent Context's pipeline.
|
boolean |
isPassivationEnabled()
Gets whether the webapp is configured for passivation.
|
void |
lifecycleEvent(org.apache.catalina.LifecycleEvent event) |
String |
listLocalSessionIds()
Lists all session ids known to this manager, excluding those in the distributed store that have not been accessed on this
node.
|
String |
locate(String sessionId)
Locate the most appropriate jvm route for the specified sessionId
|
void |
notifyLocalAttributeModification(String realId)
Callback from the distributed cache notifying of a local modification to a session's attributes.
|
void |
notifyRemoteInvalidation(String realId)
Notifies the manager that a session in the distributed cache has been invalidated
|
Map.Entry<String,String> |
parse(String sessionId) |
protected void |
processExpirationPassivation() |
void |
remove(org.apache.catalina.Session s) |
void |
removeLocal(org.apache.catalina.Session s)
Remove the active session locally from the manager without replicating to the cluster.
|
void |
sessionActivated()
Notification that a previously passivated session has been activated.
|
boolean |
sessionChangedInDistributedCache(String realId,
String dataOwner,
int distributedVersion,
long timestamp,
DistributableSessionMetadata metadata)
Callback from the distributed cache to notify us that a session has been modified remotely.
|
void |
setMaxUnreplicatedInterval(int maxUnreplicatedInterval)
Sets the maximum interval between requests, in seconds, after which a request will trigger replication of the session's
metadata regardless of whether the request has otherwise made the session dirty.
|
void |
start() |
void |
stop() |
boolean |
storeSession(org.apache.catalina.Session s)
Store the modified session.
|
addLifecycleListener, calcActiveSessions, findLifecycleListeners, getActiveSessionCount, getCreatedSessionCount, getExpiredSessionCount, getLocalActiveSessionCount, getMaxActiveAllowed, getMaxActiveSessionCount, getMaxActiveSessions, getMaxLocalActiveSessionCount, getRejectedSessionCount, getRejectedSessions, getReplicationStatistics, getTimeSinceLastReset, load, processExpires, removeLifecycleListener, resetStats, sessionExpired, setMaxActiveAllowed, setNewSessionCookie, setRejectedSessions, unloadaddPropertyChangeListener, backgroundProcess, changeSessionId, destroy, encode, expireSession, generateSessionId, getActiveSessions, getClassName, getContainer, getCreationTime, getDistributable, getDomain, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getMaxActive, getMaxInactiveInterval, getNewSession, getObjectName, getProcessExpiresFrequency, getProcessingTime, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, init, listSessionIds, postDeregister, postRegister, preDeregister, preRegister, removePropertyChangeListener, setContainer, setDistributable, setDuplicates, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTimeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetJvmRoutegetJvmRoute, setNewSessionCookieaddPropertyChangeListener, backgroundProcess, changeSessionId, getActiveSessions, getContainer, getDistributable, getExpiredSessions, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, load, removePropertyChangeListener, setContainer, setDistributable, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setRejectedSessions, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, unloadexpireSession, getCreationTime, getDuplicates, getLastAccessedTime, getSessionAttribute, listSessionIds, setDuplicatesgetActiveSessionCount, getActiveSessions, getClassName, getCreatedSessionCount, getDistributable, getExpiredSessionCount, getExpiredSessions, getLocalActiveSessionCount, getMaxActive, getMaxActiveAllowed, getMaxActiveSessionCount, getMaxActiveSessions, getMaxInactiveInterval, getMaxLocalActiveSessionCount, getProcessExpiresFrequency, getProcessingTime, getRejectedSessionCount, getRejectedSessions, getReplicationStatistics, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, getTimeSinceLastReset, resetStats, setDistributable, setMaxActive, setMaxActiveAllowed, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setSessionCounter, setSessionMaxAliveTimepublic DistributableSessionManager(DistributedCacheManagerFactory factory, org.apache.catalina.Context context, org.jboss.metadata.web.jboss.JBossWebMetaData metaData, org.jboss.marshalling.ClassResolver resolver) throws ClusteringNotSupportedException
ClusteringNotSupportedExceptionpublic String getHostName()
getHostName in interface LocalDistributableSessionManagerpublic String getContextName()
getContextName in interface LocalDistributableSessionManagerpublic String getName()
LocalDistributableSessionManagergetName in interface LocalDistributableSessionManagergetName in interface SessionManagerMBeangetName in class org.apache.catalina.session.ManagerBasepublic void start()
throws org.apache.catalina.LifecycleException
start in interface org.apache.catalina.Lifecyclestart in class AbstractSessionManagerorg.apache.catalina.LifecycleExceptionprotected void installValves()
protected SnapshotManager createSnapshotManager()
protected void initializeUnloadedSessions()
protected ClusteredSessionNotificationPolicy createClusteredSessionNotificationPolicy()
public void stop()
throws org.apache.catalina.LifecycleException
stop in interface org.apache.catalina.Lifecyclestop in class AbstractSessionManagerorg.apache.catalina.LifecycleExceptionpublic org.apache.catalina.Session createSession(String sessionId, Random random)
createSession in interface org.apache.catalina.ManagercreateSession in class org.apache.catalina.session.ManagerBaseprotected boolean appendJVMRoute()
appendJVMRoute in class org.apache.catalina.session.ManagerBasepublic ClusteredSession<O> createEmptySession()
createEmptySession in interface org.apache.catalina.ManagercreateEmptySession in class org.apache.catalina.session.ManagerBasepublic ClusteredSession<O> findSession(String id)
findSession in interface org.apache.catalina.ManagerfindSession in class org.apache.catalina.session.ManagerBasepublic org.apache.catalina.Session[] findSessions()
findSessions in interface org.apache.catalina.ManagerfindSessions in class org.apache.catalina.session.ManagerBasepublic void remove(org.apache.catalina.Session s)
remove in interface org.apache.catalina.Managerremove in class org.apache.catalina.session.ManagerBasepublic void lifecycleEvent(org.apache.catalina.LifecycleEvent event)
lifecycleEvent in interface org.apache.catalina.LifecycleListenerpublic String locate(String sessionId)
SessionManagerlocate in interface SessionManagersessionId - a session identifierpublic void removeLocal(org.apache.catalina.Session s)
SessionManagerremoveLocal in interface SessionManagerpublic boolean storeSession(org.apache.catalina.Session s)
SessionManagerstoreSession in interface SessionManagerpublic String getInfo()
getInfo in interface org.apache.catalina.ManagergetInfo in class org.apache.catalina.session.ManagerBasepublic void add(org.apache.catalina.Session session)
add in interface org.apache.catalina.Manageradd in class org.apache.catalina.session.ManagerBasepublic String getCacheConfigName()
DistributableSessionManagerMBeangetCacheConfigName in interface DistributableSessionManagerMBeannull if this has not yet been configured or the cache was directly injected.public org.jboss.metadata.web.jboss.ReplicationGranularity getReplicationGranularity()
DistributableSessionManagerMBeangetReplicationGranularity in interface DistributableSessionManagerMBeannull if this has not yet been configured.public org.jboss.metadata.web.jboss.SnapshotMode getSnapshotMode()
DistributableSessionManagerMBeangetSnapshotMode in interface DistributableSessionManagerMBeanpublic int getSnapshotInterval()
DistributableSessionManagerMBeangetSnapshotInterval in interface DistributableSessionManagerMBeanpublic void setMaxUnreplicatedInterval(int maxUnreplicatedInterval)
DistributableSessionManagerMBeansetMaxUnreplicatedInterval in interface DistributableSessionManagerMBeanmaxUnreplicatedInterval - the maximum interval since last replication after which a request will trigger session
metadata replication. A value of 0 means replicate metadata on every request; a value of
-1 means never replicate metadata unless the session is otherwise dirty.public String listLocalSessionIds()
DistributableSessionManagerMBeanlistLocalSessionIds in interface DistributableSessionManagerMBeanpublic long getPassivatedSessionCount()
DistributableSessionManagerMBeangetPassivatedSessionCount in interface DistributableSessionManagerMBeanpublic long getMaxPassivatedSessionCount()
DistributableSessionManagerMBeangetMaxPassivatedSessionCount in interface DistributableSessionManagerMBeanpublic long getPassivationMaxIdleTime()
DistributableSessionManagerMBeanpassivation is enabled.getPassivationMaxIdleTime in interface DistributableSessionManagerMBeanpublic long getPassivationMinIdleTime()
DistributableSessionManagerMBeanpassivation is enabled and the manager needs to passivate sessions early in order to comply with a
SessionManagerMBean.getMaxActiveAllowed() setting.getPassivationMinIdleTime in interface DistributableSessionManagerMBeanpublic int getMaxUnreplicatedInterval()
ClusteredSessionManager-1.
The cost of the metadata replication depends on the configured replication granularity. With SESSION, the sesssion's attribute map is replicated along with the metadata,
so it can be fairly costly. With other granularities, the metadata object is replicated separately from the attributes
and only contains a String, and a few longs, ints and booleans.getMaxUnreplicatedInterval in interface ClusteredSessionManager<O extends OutgoingDistributableSessionData>getMaxUnreplicatedInterval in interface DistributableSessionManagerMBean0 means replicate metadata on every request; a value of -1 means never
replicate metadata unless the session is otherwise dirty.public ClusteredSessionNotificationPolicy getNotificationPolicy()
ClusteredSessionManagergetNotificationPolicy in interface ClusteredSessionManager<O extends OutgoingDistributableSessionData>public org.jboss.metadata.web.jboss.ReplicationTrigger getReplicationTrigger()
ClusteredSessionManagergetReplicationTrigger in interface ClusteredSessionManager<O extends OutgoingDistributableSessionData>getReplicationTrigger in interface DistributableSessionManagerMBeannull if this has not yet been configured.public boolean getUseJK()
DistributableSessionManagerMBeangetUseJK in interface DistributableSessionManagerMBeanpublic DistributedCacheManager<O> getDistributedCacheManager()
ClusteredSessionManagerDistributedCacheManager through which we interact with the distributed cache.getDistributedCacheManager in interface ClusteredSessionManager<O extends OutgoingDistributableSessionData>public boolean isPassivationEnabled()
LocalDistributableSessionManagerisPassivationEnabled in interface LocalDistributableSessionManagerisPassivationEnabled in interface DistributableSessionManagerMBeantrue if passivation is enabledpublic String getEngineName()
LocalDistributableSessionManagergetEngineName in interface LocalDistributableSessionManagerpublic org.jboss.marshalling.ClassResolver getApplicationClassResolver()
LocalDistributableSessionManagergetApplicationClassResolver in interface LocalDistributableSessionManagernullpublic org.jboss.metadata.web.jboss.ReplicationConfig getReplicationConfig()
LocalDistributableSessionManagergetReplicationConfig in interface LocalDistributableSessionManagernullpublic void notifyRemoteInvalidation(String realId)
LocalDistributableSessionManagernotifyRemoteInvalidation in interface LocalDistributableSessionManagerrealId - the session id excluding any jvmRoutepublic void notifyLocalAttributeModification(String realId)
LocalDistributableSessionManagernotifyLocalAttributeModification in interface LocalDistributableSessionManagerrealId - the session id excluding any jvmRoutepublic void sessionActivated()
LocalDistributableSessionManagersessionActivated in interface LocalDistributableSessionManagerpublic boolean sessionChangedInDistributedCache(String realId, String dataOwner, int distributedVersion, long timestamp, DistributableSessionMetadata metadata)
LocalDistributableSessionManagersessionChangedInDistributedCache in interface LocalDistributableSessionManagerrealId - the session id, without any trailing jvmRoutedataOwner - the owner of the session. Can be null if the owner is unknown.distributedVersion - the session's version per the distributed cachetimestamp - the session's timestamp per the distributed cachemetadata - the session's metadata per the distributed cacheprotected void processExpirationPassivation()
processExpirationPassivation in class AbstractSessionManagerpublic Map.Entry<String,String> parse(String sessionId)
parse in interface SessionManagerparse in class AbstractSessionManagerpublic String createSessionId(String realId, String jvmRoute)
createSessionId in interface SessionManagercreateSessionId in class AbstractSessionManagerprotected int getTotalActiveSessions()
AbstractSessionManagergetTotalActiveSessions in class AbstractSessionManagerCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.