Package org.apache.catalina.session
Class ManagerBase
- java.lang.Object
- 
- org.apache.catalina.util.LifecycleBase
- 
- org.apache.catalina.util.LifecycleMBeanBase
- 
- org.apache.catalina.session.ManagerBase
 
 
 
- 
- All Implemented Interfaces:
- javax.management.MBeanRegistration,- JmxEnabled,- Lifecycle,- Manager
 - Direct Known Subclasses:
- ClusterManagerBase,- PersistentManagerBase,- StandardManager
 
 public abstract class ManagerBase extends LifecycleMBeanBase implements Manager Minimal implementation of the Manager interface that supports no session persistence or distributable capabilities. This class may be subclassed to create more sophisticated Manager implementations.- Author:
- Craig R. McClanahan
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static classManagerBase.SessionTiming- 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected intduplicatesprotected java.util.concurrent.atomic.AtomicLongexpiredSessionsNumber of sessions that have expired.protected intmaxActiveprotected intmaxActiveSessionsThe maximum number of active Sessions allowed, or -1 for no limit.protected intprocessExpiresFrequencyFrequency of the session expiration, and related manager operations.protected longprocessingTimeProcessing time during session expiration.protected intrejectedSessionsNumber of session creations that failed due to maxActiveSessions.protected java.lang.StringsecureRandomAlgorithmThe name of the algorithm to use to create instances ofSecureRandomwhich are used to generate session IDs.protected java.lang.StringsecureRandomClassThe Java class name of the secure random number generator class to be used when generating session identifiers.protected java.lang.StringsecureRandomProviderThe name of the provider to use to create instances ofSecureRandomwhich are used to generate session IDs.protected longsessionCounterprotected java.util.Deque<ManagerBase.SessionTiming>sessionCreationTimingprotected java.util.Deque<ManagerBase.SessionTiming>sessionExpirationTimingprotected SessionIdGeneratorsessionIdGeneratorprotected java.lang.Class<? extends SessionIdGenerator>sessionIdGeneratorClassprotected intsessionMaxAliveTimeThe longest time (in seconds) that an expired session had been alive.protected java.util.Map<java.lang.String,Session>sessionsThe set of currently active Sessions for this Manager, keyed by session identifier.protected static StringManagersmThe string manager for this package.protected java.beans.PropertyChangeSupportsupportThe property change support for this component.protected static intTIMING_STATS_CACHE_SIZE- 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBasemserver
 - 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_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 SummaryConstructors Constructor Description ManagerBase()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(Session session)Add this Session to the set of active Sessions for this Manager.voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Add a property change listener to this component.voidbackgroundProcess()This method will be invoked by the context/container on a periodic basis and allows the manager to implement a method that executes periodic tasks, such as expiring sessions etc.voidchangeSessionId(Session session)Change the session ID of the current session to a new randomly generated session ID.voidchangeSessionId(Session session, java.lang.String newId)Change the session ID of the current session to a specified session ID.protected voidchangeSessionId(Session session, java.lang.String newId, boolean notifySessionListeners, boolean notifyContainerListeners)SessioncreateEmptySession()Get a session from the recycled ones or create a new empty one.SessioncreateSession(java.lang.String sessionId)Construct and return a new session object, based on the default settings specified by this Manager's properties.voidexpireSession(java.lang.String sessionId)SessionfindSession(java.lang.String id)Return the active Session, associated with this Manager, with the specified session id (if any); otherwise returnnull.Session[]findSessions()Return the set of active Sessions associated with this Manager.protected java.lang.StringgenerateSessionId()Generate and return a new session identifier.intgetActiveSessions()Gets the number of currently active sessions.java.lang.StringgetClassName()ContextgetContext()Get the Context with which this Manager is associated.java.lang.StringgetCreationTime(java.lang.String sessionId)longgetCreationTimestamp(java.lang.String sessionId)java.lang.StringgetDomainInternal()Method implemented by sub-classes to identify the domain in which MBeans should be registered.intgetDuplicates()Number of duplicated session IDs generated by the random source.EnginegetEngine()Retrieve the enclosing Engine for this Manager.longgetExpiredSessions()Gets the number of sessions that have expired.java.lang.StringgetJvmRoute()Retrieve the JvmRoute for the enclosing Engine.java.lang.StringgetLastAccessedTime(java.lang.String sessionId)longgetLastAccessedTimestamp(java.lang.String sessionId)intgetMaxActive()Gets the maximum number of sessions that have been active at the same time.intgetMaxActiveSessions()java.lang.StringgetName()protected StandardSessiongetNewSession()Get new session class to be used in the doLoad() method.booleangetNotifyAttributeListenerOnUnchangedValue()When an attribute that is already present in the session is added again under the same name and aHttpSessionAttributeListeneris configured for the session shouldHttpSessionAttributeListener.attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)be called?booleangetNotifyBindingListenerOnUnchangedValue()When an attribute that is already present in the session is added again under the same name and the attribute implementsHttpSessionBindingListener, shouldHttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)be called followed byHttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)?java.lang.StringgetObjectNameKeyProperties()Allow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.booleangetPersistAuthentication()Return whether sessions managed by this manager shall persist authentication information or not.booleangetPersistAuthenticationNotes()Deprecated.Will be removed in Tomcat 10.1.x where it is effectively hard-coded totrueintgetProcessExpiresFrequency()longgetProcessingTime()intgetRejectedSessions()Gets the number of sessions that were not created because the maximum number of active sessions was reached.java.lang.StringgetSecureRandomAlgorithm()java.lang.StringgetSecureRandomClass()java.lang.StringgetSecureRandomProvider()java.util.HashMap<java.lang.String,java.lang.String>getSession(java.lang.String sessionId)Returns information about the session with the given session id.java.lang.StringgetSessionAttribute(java.lang.String sessionId, java.lang.String key)For debugging.java.lang.StringgetSessionAttributeNameFilter()Obtain the regular expression used to filter session attribute based on attribute name.protected java.util.regex.PatterngetSessionAttributeNamePattern()ProvidesgetSessionAttributeNameFilter()as a pre-compiled regular expression pattern.java.lang.StringgetSessionAttributeValueClassNameFilter()Obtain the regular expression used to filter session attribute based on the implementation class of the value.protected java.util.regex.PatterngetSessionAttributeValueClassNamePattern()ProvidesgetSessionAttributeValueClassNameFilter()as a pre-compiled regular expression pattern.intgetSessionAverageAliveTime()Gets the average time (in seconds) that expired sessions had been alive.longgetSessionCounter()Returns the total number of sessions created by this manager.intgetSessionCreateRate()Gets the current rate of session creation (in session per minute).intgetSessionExpireRate()Gets the current rate of session expiration (in session per minute).SessionIdGeneratorgetSessionIdGenerator()intgetSessionMaxAliveTime()Gets the longest time (in seconds) that an expired session had been alive.java.lang.StringgetThisAccessedTime(java.lang.String sessionId)longgetThisAccessedTimestamp(java.lang.String sessionId)booleangetWarnOnSessionAttributeFilterFailure()Should a warn level log message be generated if a session attribute is not persisted / replicated / restored.protected voidinitInternal()Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.java.lang.StringlistSessionIds()For debugging.voidprocessExpires()Invalidate all sessions that have expired.voidremove(Session session)Remove this Session from the active Sessions for this Manager.voidremove(Session session, boolean update)Remove this Session from the active Sessions for this Manager.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove a property change listener from this component.java.lang.StringrotateSessionId(Session session)Change the session ID of the current session to a new randomly generated session ID.voidsetContext(Context context)Set the Context with which this Manager is associated.voidsetDuplicates(int duplicates)voidsetExpiredSessions(long expiredSessions)Sets the number of sessions that have expired.voidsetMaxActive(int maxActive)(Re)sets the maximum number of sessions that have been active at the same time.voidsetMaxActiveSessions(int max)Set the maximum number of active Sessions allowed, or -1 for no limit.voidsetNotifyAttributeListenerOnUnchangedValue(boolean notifyAttributeListenerOnUnchangedValue)Configure ifHttpSessionAttributeListener.attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)when an attribute that is already present in the session is added again under the same name and aHttpSessionAttributeListeneris configured for the session.voidsetNotifyBindingListenerOnUnchangedValue(boolean notifyBindingListenerOnUnchangedValue)Configure ifHttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)be called followed byHttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)when an attribute that is already present in the session is added again under the same name and the attribute implementsHttpSessionBindingListener.voidsetPersistAuthentication(boolean persistAuthentication)Set whether sessions managed by this manager shall persist authentication information or not.voidsetPersistAuthenticationNotes(boolean persistAuthenticationNotes)Deprecated.Will be removed in Tomcat 10.1.x where it is effectively hard-coded totruevoidsetProcessExpiresFrequency(int processExpiresFrequency)Set the manager checks frequency.voidsetProcessingTime(long processingTime)voidsetSecureRandomAlgorithm(java.lang.String secureRandomAlgorithm)Set the secure random number generator algorithm name.voidsetSecureRandomClass(java.lang.String secureRandomClass)Set the secure random number generator class name.voidsetSecureRandomProvider(java.lang.String secureRandomProvider)Set the secure random number generator provider name.voidsetSessionAttributeNameFilter(java.lang.String sessionAttributeNameFilter)Set the regular expression to use to filter session attributes based on attribute name.voidsetSessionAttributeValueClassNameFilter(java.lang.String sessionAttributeValueClassNameFilter)Set the regular expression to use to filter classes used for session attributes.voidsetSessionCounter(long sessionCounter)Sets the total number of sessions created by this manager.voidsetSessionIdGenerator(SessionIdGenerator sessionIdGenerator)Sets the session id generatorvoidsetSessionMaxAliveTime(int sessionMaxAliveTime)Sets the longest time (in seconds) that an expired session had been alive.voidsetWarnOnSessionAttributeFilterFailure(boolean warnOnSessionAttributeFilterFailure)Configure whether or not a warn level log message should be generated if a session attribute is not persisted / replicated / restored.protected voidstartInternal()Sub-classes must ensure that the state is changed toLifecycleState.STARTINGduring the execution of this method.protected voidstopInternal()Sub-classes must ensure that the state is changed toLifecycleState.STOPPINGduring the execution of this method.java.lang.StringtoString()voidupdateSessionMaxAliveTime(int sessionAliveTime)Updates the sessionMaxAliveTime attribute if the candidate value is larger than the current value.booleanwillAttributeDistribute(java.lang.String name, java.lang.Object value)Would the Manager distribute the given session attribute?- 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBasedestroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
 - 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 
- 
 
- 
- 
- 
Field Detail- 
secureRandomClassprotected java.lang.String secureRandomClass The Java class name of the secure random number generator class to be used when generating session identifiers. The random number generator class must be self-seeding and have a zero-argument constructor. If not specified, an instance ofSecureRandomwill be generated.
 - 
secureRandomAlgorithmprotected java.lang.String secureRandomAlgorithm The name of the algorithm to use to create instances ofSecureRandomwhich are used to generate session IDs. If no algorithm is specified, SHA1PRNG is used. If SHA1PRNG is not available, the platform default will be used. To use the platform default (which may be SHA1PRNG), specify the empty string. If an invalid algorithm and/or provider is specified the SecureRandom instances will be created using the defaults. If that fails, the SecureRandom instances will be created using platform defaults.
 - 
secureRandomProviderprotected java.lang.String secureRandomProvider The name of the provider to use to create instances ofSecureRandomwhich are used to generate session IDs. If no provider is specified the platform default is used. If an invalid algorithm and/or provider is specified the SecureRandom instances will be created using the defaults. If that fails, the SecureRandom instances will be created using platform defaults.
 - 
sessionIdGeneratorprotected SessionIdGenerator sessionIdGenerator 
 - 
sessionIdGeneratorClassprotected java.lang.Class<? extends SessionIdGenerator> sessionIdGeneratorClass 
 - 
sessionMaxAliveTimeprotected volatile int sessionMaxAliveTime The longest time (in seconds) that an expired session had been alive.
 - 
TIMING_STATS_CACHE_SIZEprotected static final int TIMING_STATS_CACHE_SIZE - See Also:
- Constant Field Values
 
 - 
sessionCreationTimingprotected final java.util.Deque<ManagerBase.SessionTiming> sessionCreationTiming 
 - 
sessionExpirationTimingprotected final java.util.Deque<ManagerBase.SessionTiming> sessionExpirationTiming 
 - 
expiredSessionsprotected final java.util.concurrent.atomic.AtomicLong expiredSessions Number of sessions that have expired.
 - 
sessionsprotected java.util.Map<java.lang.String,Session> sessions The set of currently active Sessions for this Manager, keyed by session identifier.
 - 
sessionCounterprotected long sessionCounter 
 - 
maxActiveprotected volatile int maxActive 
 - 
maxActiveSessionsprotected int maxActiveSessions The maximum number of active Sessions allowed, or -1 for no limit.
 - 
rejectedSessionsprotected int rejectedSessions Number of session creations that failed due to maxActiveSessions.
 - 
duplicatesprotected volatile int duplicates 
 - 
processingTimeprotected long processingTime Processing time during session expiration.
 - 
processExpiresFrequencyprotected int processExpiresFrequency Frequency of the session expiration, and related manager operations. Manager operations will be done once for the specified amount of backgroundProcess calls (ie, the lower the amount, the most often the checks will occur).
 - 
smprotected static final StringManager sm The string manager for this package.
 - 
supportprotected final java.beans.PropertyChangeSupport support The property change support for this component.
 
- 
 - 
Method Detail- 
getNotifyAttributeListenerOnUnchangedValuepublic boolean getNotifyAttributeListenerOnUnchangedValue() Description copied from interface:ManagerWhen an attribute that is already present in the session is added again under the same name and aHttpSessionAttributeListeneris configured for the session shouldHttpSessionAttributeListener.attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)be called?The default value is true.- Specified by:
- getNotifyAttributeListenerOnUnchangedValuein interface- Manager
- Returns:
- trueif the listener will be notified,- falseif it will not
 
 - 
setNotifyAttributeListenerOnUnchangedValuepublic void setNotifyAttributeListenerOnUnchangedValue(boolean notifyAttributeListenerOnUnchangedValue) Description copied from interface:ManagerConfigure ifHttpSessionAttributeListener.attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)when an attribute that is already present in the session is added again under the same name and aHttpSessionAttributeListeneris configured for the session.- Specified by:
- setNotifyAttributeListenerOnUnchangedValuein interface- Manager
- Parameters:
- notifyAttributeListenerOnUnchangedValue-- truethe listener will be called,- falseit will not
 
 - 
getNotifyBindingListenerOnUnchangedValuepublic boolean getNotifyBindingListenerOnUnchangedValue() Description copied from interface:ManagerWhen an attribute that is already present in the session is added again under the same name and the attribute implementsHttpSessionBindingListener, shouldHttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)be called followed byHttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)?The default value is false.- Specified by:
- getNotifyBindingListenerOnUnchangedValuein interface- Manager
- Returns:
- trueif the listener will be notified,- falseif it will not
 
 - 
setNotifyBindingListenerOnUnchangedValuepublic void setNotifyBindingListenerOnUnchangedValue(boolean notifyBindingListenerOnUnchangedValue) Description copied from interface:ManagerConfigure ifHttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)be called followed byHttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)when an attribute that is already present in the session is added again under the same name and the attribute implementsHttpSessionBindingListener.- Specified by:
- setNotifyBindingListenerOnUnchangedValuein interface- Manager
- Parameters:
- notifyBindingListenerOnUnchangedValue-- truethe listener will be called,- falseit will not
 
 - 
getSessionAttributeNameFilterpublic java.lang.String getSessionAttributeNameFilter() Obtain the regular expression used to filter session attribute based on attribute name. The regular expression is anchored so it must match the entire name- Returns:
- The regular expression currently used to filter attribute names. nullmeans no filter is applied. If an empty string is specified then no names will match the filter and all attributes will be blocked.
 
 - 
setSessionAttributeNameFilterpublic void setSessionAttributeNameFilter(java.lang.String sessionAttributeNameFilter) throws java.util.regex.PatternSyntaxExceptionSet the regular expression to use to filter session attributes based on attribute name. The regular expression is anchored so it must match the entire name.- Parameters:
- sessionAttributeNameFilter- The regular expression to use to filter session attributes based on attribute name. Use- nullif no filtering is required. If an empty string is specified then no names will match the filter and all attributes will be blocked.
- Throws:
- java.util.regex.PatternSyntaxException- If the expression is not valid
 
 - 
getSessionAttributeNamePatternprotected java.util.regex.Pattern getSessionAttributeNamePattern() ProvidesgetSessionAttributeNameFilter()as a pre-compiled regular expression pattern.- Returns:
- The pre-compiled pattern used to filter session attributes based on attribute name. nullmeans no filter is applied.
 
 - 
getSessionAttributeValueClassNameFilterpublic java.lang.String getSessionAttributeValueClassNameFilter() Obtain the regular expression used to filter session attribute based on the implementation class of the value. The regular expression is anchored and must match the fully qualified class name.- Returns:
- The regular expression currently used to filter class names. nullmeans no filter is applied. If an empty string is specified then no names will match the filter and all attributes will be blocked.
 
 - 
getSessionAttributeValueClassNamePatternprotected java.util.regex.Pattern getSessionAttributeValueClassNamePattern() ProvidesgetSessionAttributeValueClassNameFilter()as a pre-compiled regular expression pattern.- Returns:
- The pre-compiled pattern used to filter session attributes based on the implementation class name of the
             value. nullmeans no filter is applied.
 
 - 
setSessionAttributeValueClassNameFilterpublic void setSessionAttributeValueClassNameFilter(java.lang.String sessionAttributeValueClassNameFilter) throws java.util.regex.PatternSyntaxExceptionSet the regular expression to use to filter classes used for session attributes. The regular expression is anchored and must match the fully qualified class name.- Parameters:
- sessionAttributeValueClassNameFilter- The regular expression to use to filter session attributes based on class name. Use- nullif no filtering is required. If an empty string is specified then no names will match the filter and all attributes will be blocked.
- Throws:
- java.util.regex.PatternSyntaxException- If the expression is not valid
 
 - 
getWarnOnSessionAttributeFilterFailurepublic boolean getWarnOnSessionAttributeFilterFailure() Should a warn level log message be generated if a session attribute is not persisted / replicated / restored.- Returns:
- trueif a warn level log message should be generated
 
 - 
setWarnOnSessionAttributeFilterFailurepublic void setWarnOnSessionAttributeFilterFailure(boolean warnOnSessionAttributeFilterFailure) Configure whether or not a warn level log message should be generated if a session attribute is not persisted / replicated / restored.- Parameters:
- warnOnSessionAttributeFilterFailure-- trueif the warn level message should be generated
 
 - 
getContextpublic Context getContext() Description copied from interface:ManagerGet the Context with which this Manager is associated.- Specified by:
- getContextin interface- Manager
- Returns:
- The associated Context
 
 - 
setContextpublic void setContext(Context context) Description copied from interface:ManagerSet the Context with which this Manager is associated. The Context must be set to a non-null value before the Manager is first used. Multiple calls to this method before first use are permitted. Once the Manager has been used, this method may not be used to change the Context (including setting anullvalue) that the Manager is associated with.- Specified by:
- setContextin interface- Manager
- Parameters:
- context- The newly associated Context
 
 - 
getClassNamepublic java.lang.String getClassName() - Returns:
- The name of the implementation class.
 
 - 
getSessionIdGeneratorpublic SessionIdGenerator getSessionIdGenerator() - Specified by:
- getSessionIdGeneratorin interface- Manager
- Returns:
- the session id generator
 
 - 
setSessionIdGeneratorpublic void setSessionIdGenerator(SessionIdGenerator sessionIdGenerator) Description copied from interface:ManagerSets the session id generator- Specified by:
- setSessionIdGeneratorin interface- Manager
- Parameters:
- sessionIdGenerator- The session id generator
 
 - 
getNamepublic java.lang.String getName() - Returns:
- The descriptive short name of this Manager implementation.
 
 - 
getSecureRandomClasspublic java.lang.String getSecureRandomClass() - Returns:
- The secure random number generator class name.
 
 - 
setSecureRandomClasspublic void setSecureRandomClass(java.lang.String secureRandomClass) Set the secure random number generator class name.- Parameters:
- secureRandomClass- The new secure random number generator class name
 
 - 
getSecureRandomAlgorithmpublic java.lang.String getSecureRandomAlgorithm() - Returns:
- The secure random number generator algorithm name.
 
 - 
setSecureRandomAlgorithmpublic void setSecureRandomAlgorithm(java.lang.String secureRandomAlgorithm) Set the secure random number generator algorithm name.- Parameters:
- secureRandomAlgorithm- The new secure random number generator algorithm name
 
 - 
getSecureRandomProviderpublic java.lang.String getSecureRandomProvider() - Returns:
- The secure random number generator provider name.
 
 - 
setSecureRandomProviderpublic void setSecureRandomProvider(java.lang.String secureRandomProvider) Set the secure random number generator provider name.- Parameters:
- secureRandomProvider- The new secure random number generator provider name
 
 - 
getRejectedSessionspublic int getRejectedSessions() Description copied from interface:ManagerGets the number of sessions that were not created because the maximum number of active sessions was reached.- Specified by:
- getRejectedSessionsin interface- Manager
- Returns:
- Number of rejected sessions
 
 - 
getExpiredSessionspublic long getExpiredSessions() Description copied from interface:ManagerGets the number of sessions that have expired.- Specified by:
- getExpiredSessionsin interface- Manager
- Returns:
- Number of sessions that have expired
 
 - 
setExpiredSessionspublic void setExpiredSessions(long expiredSessions) Description copied from interface:ManagerSets the number of sessions that have expired.- Specified by:
- setExpiredSessionsin interface- Manager
- Parameters:
- expiredSessions- Number of sessions that have expired
 
 - 
getProcessingTimepublic long getProcessingTime() 
 - 
setProcessingTimepublic void setProcessingTime(long processingTime) 
 - 
getProcessExpiresFrequencypublic int getProcessExpiresFrequency() - Returns:
- The frequency of manager checks.
 
 - 
setProcessExpiresFrequencypublic void setProcessExpiresFrequency(int processExpiresFrequency) Set the manager checks frequency.- Parameters:
- processExpiresFrequency- the new manager checks frequency
 
 - 
getPersistAuthenticationpublic boolean getPersistAuthentication() Return whether sessions managed by this manager shall persist authentication information or not.- Returns:
- true, sessions managed by this manager shall persist authentication information;- falseotherwise
 
 - 
setPersistAuthenticationpublic void setPersistAuthentication(boolean persistAuthentication) Set whether sessions managed by this manager shall persist authentication information or not.- Parameters:
- persistAuthentication- if- true, sessions managed by this manager shall persist authentication information
 
 - 
getPersistAuthenticationNotes@Deprecated public boolean getPersistAuthenticationNotes() Deprecated.Will be removed in Tomcat 10.1.x where it is effectively hard-coded totrueReturn whether sessions managed by this manager shall persist authentication notes used by FORM authentication or not.- Returns:
- true, sessions managed by this manager shall persist authentication notes used by FORM authentication;- falseotherwise
 
 - 
setPersistAuthenticationNotes@Deprecated public void setPersistAuthenticationNotes(boolean persistAuthenticationNotes) Deprecated.Will be removed in Tomcat 10.1.x where it is effectively hard-coded totrueSet whether sessions managed by this manager shall persist authentication notes used by FORM authentication or not.- Parameters:
- persistAuthenticationNotes- if- true, sessions managed by this manager shall persist authentication notes used by FORM authentication
 
 - 
backgroundProcesspublic void backgroundProcess() This method will be invoked by the context/container on a periodic basis and allows the manager to implement a method that executes periodic tasks, such as expiring sessions etc.Direct call to processExpires()- Specified by:
- backgroundProcessin interface- Manager
 
 - 
processExpirespublic void processExpires() Invalidate all sessions that have expired.
 - 
initInternalprotected void initInternal() throws LifecycleExceptionDescription copied from class:LifecycleMBeanBaseSub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.- Overrides:
- initInternalin class- LifecycleMBeanBase
- Throws:
- LifecycleException- If the initialisation fails
 
 - 
startInternalprotected void startInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSub-classes must ensure that the state is changed toLifecycleState.STARTINGduring the execution of this method. Changing state will trigger theLifecycle.START_EVENTevent. If a component fails to start it may either throw aLifecycleExceptionwhich will cause it's parent to fail to start or it can place itself in the error state in which caseLifecycleBase.stop()will be called on the failed component but the parent component will continue to start normally.- Specified by:
- startInternalin class- LifecycleBase
- Throws:
- LifecycleException- Start error occurred
 
 - 
stopInternalprotected void stopInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSub-classes must ensure that the state is changed toLifecycleState.STOPPINGduring the execution of this method. Changing state will trigger theLifecycle.STOP_EVENTevent.- Specified by:
- stopInternalin class- LifecycleBase
- Throws:
- LifecycleException- Stop error occurred
 
 - 
addpublic void add(Session session) Description copied from interface:ManagerAdd this Session to the set of active Sessions for this Manager.
 - 
addPropertyChangeListenerpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener) Description copied from interface:ManagerAdd a property change listener to this component.- Specified by:
- addPropertyChangeListenerin interface- Manager
- Parameters:
- listener- The listener to add
 
 - 
createSessionpublic Session createSession(java.lang.String sessionId) Description copied from interface:ManagerConstruct and return a new session object, based on the default settings specified by this Manager's properties. The session id specified will be used as the session id. If a new session cannot be created for any reason, returnnull.- Specified by:
- createSessionin interface- Manager
- Parameters:
- sessionId- The session id which should be used to create the new session; if- null, the session id will be assigned by this method, and available via the getId() method of the returned session.
- Returns:
- An empty Session object with the given ID or a newly created session ID if none was specified
 
 - 
createEmptySessionpublic Session createEmptySession() Description copied from interface:ManagerGet a session from the recycled ones or create a new empty one. The PersistentManager manager does not need to create session data because it reads it from the Store.- Specified by:
- createEmptySessionin interface- Manager
- Returns:
- An empty Session object
 
 - 
findSessionpublic Session findSession(java.lang.String id) throws java.io.IOException Description copied from interface:ManagerReturn the active Session, associated with this Manager, with the specified session id (if any); otherwise returnnull.- Specified by:
- findSessionin interface- Manager
- Parameters:
- id- The session id for the session to be returned
- Returns:
- the request session or nullif a session with the requested ID could not be found
- Throws:
- java.io.IOException- if an input/output error occurs while processing this request
 
 - 
findSessionspublic Session[] findSessions() Description copied from interface:ManagerReturn 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 interface- Manager
- Returns:
- All the currently active sessions managed by this manager
 
 - 
removepublic void remove(Session session) Description copied from interface:ManagerRemove this Session from the active Sessions for this Manager.
 - 
removepublic void remove(Session session, boolean update) Description copied from interface:ManagerRemove this Session from the active Sessions for this Manager.
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener) Description copied from interface:ManagerRemove a property change listener from this component.- Specified by:
- removePropertyChangeListenerin interface- Manager
- Parameters:
- listener- The listener to remove
 
 - 
changeSessionIdpublic void changeSessionId(Session session) Description copied from interface:ManagerChange the session ID of the current session to a new randomly generated session ID.- Specified by:
- changeSessionIdin interface- Manager
- Parameters:
- session- The session to change the session ID for
 
 - 
rotateSessionIdpublic java.lang.String rotateSessionId(Session session) Description copied from interface:ManagerChange the session ID of the current session to a new randomly generated session ID.- Specified by:
- rotateSessionIdin interface- Manager
- Parameters:
- session- The session to change the session ID for
- Returns:
- The new session ID
 
 - 
changeSessionIdpublic void changeSessionId(Session session, java.lang.String newId) Description copied from interface:ManagerChange the session ID of the current session to a specified session ID.- Specified by:
- changeSessionIdin interface- Manager
- Parameters:
- session- The session to change the session ID for
- newId- new session ID
 
 - 
changeSessionIdprotected void changeSessionId(Session session, java.lang.String newId, boolean notifySessionListeners, boolean notifyContainerListeners) 
 - 
willAttributeDistributepublic boolean willAttributeDistribute(java.lang.String name, java.lang.Object value)Would the Manager distribute the given session attribute? Manager implementations may provide additional configuration options to control which attributes are distributable.This implementation excludes session attributes from distribution if the: - attribute name matches getSessionAttributeNameFilter()
 - Specified by:
- willAttributeDistributein interface- Manager
- Parameters:
- name- The attribute name
- value- The attribute value
- Returns:
- trueif the Manager would distribute the given attribute otherwise- false
 
- attribute name matches 
 - 
getNewSessionprotected StandardSession getNewSession() Get new session class to be used in the doLoad() method.- Returns:
- a new session for use with this manager
 
 - 
generateSessionIdprotected java.lang.String generateSessionId() Generate and return a new session identifier.- Returns:
- a new session id
 
 - 
getEnginepublic Engine getEngine() Retrieve the enclosing Engine for this Manager.- Returns:
- an Engine object (or null).
 
 - 
getJvmRoutepublic java.lang.String getJvmRoute() Retrieve the JvmRoute for the enclosing Engine.- Returns:
- the JvmRoute or null.
 
 - 
setSessionCounterpublic void setSessionCounter(long sessionCounter) Description copied from interface:ManagerSets the total number of sessions created by this manager.- Specified by:
- setSessionCounterin interface- Manager
- Parameters:
- sessionCounter- Total number of sessions created by this manager.
 
 - 
getSessionCounterpublic long getSessionCounter() Description copied from interface:ManagerReturns the total number of sessions created by this manager.- Specified by:
- getSessionCounterin interface- Manager
- Returns:
- Total number of sessions created by this manager.
 
 - 
getDuplicatespublic int getDuplicates() Number of duplicated session IDs generated by the random source. Anything bigger than 0 means problems.- Returns:
- The count of duplicates
 
 - 
setDuplicatespublic void setDuplicates(int duplicates) 
 - 
getActiveSessionspublic int getActiveSessions() Description copied from interface:ManagerGets the number of currently active sessions.- Specified by:
- getActiveSessionsin interface- Manager
- Returns:
- Number of currently active sessions
 
 - 
getMaxActivepublic int getMaxActive() Description copied from interface:ManagerGets the maximum number of sessions that have been active at the same time.- Specified by:
- getMaxActivein interface- Manager
- Returns:
- Maximum number of sessions that have been active at the same time
 
 - 
setMaxActivepublic void setMaxActive(int maxActive) Description copied from interface:Manager(Re)sets the maximum number of sessions that have been active at the same time.- Specified by:
- setMaxActivein interface- Manager
- Parameters:
- maxActive- Maximum number of sessions that have been active at the same time.
 
 - 
getMaxActiveSessionspublic int getMaxActiveSessions() - Returns:
- The maximum number of active Sessions allowed, or -1 for no limit.
 
 - 
setMaxActiveSessionspublic void setMaxActiveSessions(int max) Set the maximum number of active Sessions allowed, or -1 for no limit.- Parameters:
- max- The new maximum number of sessions
 
 - 
getSessionMaxAliveTimepublic int getSessionMaxAliveTime() Description copied from interface:ManagerGets the longest time (in seconds) that an expired session had been alive.- Specified by:
- getSessionMaxAliveTimein interface- Manager
- Returns:
- Longest time (in seconds) that an expired session had been alive.
 
 - 
setSessionMaxAliveTimepublic void setSessionMaxAliveTime(int sessionMaxAliveTime) Description copied from interface:ManagerSets the longest time (in seconds) that an expired session had been alive.- Specified by:
- setSessionMaxAliveTimein interface- Manager
- Parameters:
- sessionMaxAliveTime- Longest time (in seconds) that an expired session had been alive.
 
 - 
updateSessionMaxAliveTimepublic void updateSessionMaxAliveTime(int sessionAliveTime) Updates the sessionMaxAliveTime attribute if the candidate value is larger than the current value.- Parameters:
- sessionAliveTime- The candidate value (in seconds) for the new sessionMaxAliveTime value.
 
 - 
getSessionAverageAliveTimepublic int getSessionAverageAliveTime() Gets the average time (in seconds) that expired sessions had been alive. This may be based on sample data.Based on the last 100 sessions to expire. If less than 100 sessions have expired then all available data is used. - Specified by:
- getSessionAverageAliveTimein interface- Manager
- Returns:
- Average time (in seconds) that expired sessions had been alive.
 
 - 
getSessionCreateRatepublic int getSessionCreateRate() Gets the current rate of session creation (in session per minute). This may be based on sample data.Based on the creation time of the previous 100 sessions created. If less than 100 sessions have been created then all available data is used. - Specified by:
- getSessionCreateRatein interface- Manager
- Returns:
- The current rate (in sessions per minute) of session creation
 
 - 
getSessionExpireRatepublic int getSessionExpireRate() Gets the current rate of session expiration (in session per minute). This may be based on sample dataBased on the expiry time of the previous 100 sessions expired. If less than 100 sessions have expired then all available data is used. - Specified by:
- getSessionExpireRatein interface- Manager
- Returns:
- The current rate (in sessions per minute) of session expiration
 
 - 
listSessionIdspublic java.lang.String listSessionIds() For debugging.- Returns:
- A space separated list of all session IDs currently active
 
 - 
getSessionAttributepublic java.lang.String getSessionAttribute(java.lang.String sessionId, java.lang.String key)For debugging.- Parameters:
- sessionId- The ID for the session of interest
- key- The key for the attribute to obtain
- Returns:
- The attribute value for the specified session, if found, null otherwise
 
 - 
getSessionpublic java.util.HashMap<java.lang.String,java.lang.String> getSession(java.lang.String sessionId) Returns information about the session with the given session id.The session information is organized as a HashMap, mapping session attribute names to the String representation of their values. - Parameters:
- sessionId- Session id
- Returns:
- HashMap mapping session attribute names to the String representation of their values, or null if no session with the specified id exists, or if the session does not have any attributes
 
 - 
expireSessionpublic void expireSession(java.lang.String sessionId) 
 - 
getThisAccessedTimestamppublic long getThisAccessedTimestamp(java.lang.String sessionId) 
 - 
getThisAccessedTimepublic java.lang.String getThisAccessedTime(java.lang.String sessionId) 
 - 
getLastAccessedTimestamppublic long getLastAccessedTimestamp(java.lang.String sessionId) 
 - 
getLastAccessedTimepublic java.lang.String getLastAccessedTime(java.lang.String sessionId) 
 - 
getCreationTimepublic java.lang.String getCreationTime(java.lang.String sessionId) 
 - 
getCreationTimestamppublic long getCreationTimestamp(java.lang.String sessionId) 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getObjectNameKeyPropertiespublic java.lang.String getObjectNameKeyProperties() Description copied from class:LifecycleMBeanBaseAllow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.- Specified by:
- getObjectNameKeyPropertiesin class- LifecycleMBeanBase
- Returns:
- The string representation of the key properties component of the
          desired ObjectName
 
 - 
getDomainInternalpublic java.lang.String getDomainInternal() Description copied from class:LifecycleMBeanBaseMethod implemented by sub-classes to identify the domain in which MBeans should be registered.- Specified by:
- getDomainInternalin class- LifecycleMBeanBase
- Returns:
- The name of the domain to use to register MBeans.
 
 
- 
 
-