Apache Tomcat 6.0.53

org.apache.catalina.session
Class ManagerBase

java.lang.Object
  extended by org.apache.catalina.session.ManagerBase
All Implemented Interfaces:
javax.management.MBeanRegistration, Manager
Direct Known Subclasses:
ClusterManagerBase, PersistentManagerBase, StandardManager

public abstract class ManagerBase
extends java.lang.Object
implements Manager, javax.management.MBeanRegistration

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 Summary
protected static class ManagerBase.SessionTiming
           
 
Field Summary
protected  java.lang.String algorithm
          The message digest algorithm to be used when generating session identifiers.
protected  Container container
          The Container with which this Manager is associated.
protected static java.lang.String DEFAULT_ALGORITHM
          The default message digest algorithm to use if we cannot use the requested one.
protected  java.lang.String devRandomSource
           
protected  java.security.MessageDigest digest
          Return the MessageDigest implementation to be used when creating session identifiers.
protected  boolean distributable
          Deprecated. Ignored. Context.getDistributable() always takes precedence. Will be removed in Tomcat 9.0.x.
protected  java.lang.String domain
           
protected  int duplicates
           
protected  java.lang.String entropy
          A String initialization parameter used to increase the entropy of the initialization of our random number generator.
protected  int expiredSessions
          Number of sessions that have expired.
protected  boolean initialized
           
protected  Log log
           
protected  int maxActive
           
protected  int maxInactiveInterval
          Deprecated. Ignored. Context.getSessionTimeout() always takes precedence. Will be removed in Tomcat 9.0.x.
protected  javax.management.MBeanServer mserver
           
protected static java.lang.String name
          The descriptive name of this Manager implementation (for logging).
protected  javax.management.ObjectName oname
           
protected  int processExpiresFrequency
          Frequency of the session expiration, and related manager operations.
protected  long processingTime
          Processing time during session expiration.
protected  java.util.Random random
          A random number generator to use when generating session identifiers.
protected  java.lang.String randomClass
          The Java class name of the random number generator class to be used when generating session identifiers.
protected  java.io.DataInputStream randomIS
           
protected  int sessionAverageAliveTime
          Average time (in seconds) that expired sessions had been alive.
protected  int sessionCounter
           
protected  java.util.LinkedList<ManagerBase.SessionTiming> sessionCreationTiming
           
protected  java.util.LinkedList<ManagerBase.SessionTiming> sessionExpirationTiming
           
protected  int sessionIdLength
          The session id length of Sessions created by this Manager.
protected  int sessionMaxAliveTime
          The longest time (in seconds) that an expired session had been alive.
protected  java.util.Map<java.lang.String,Session> sessions
          The set of currently active Sessions for this Manager, keyed by session identifier.
protected static StringManager sm
          The string manager for this package.
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
protected static int TIMING_STATS_CACHE_SIZE
           
 
Constructor Summary
ManagerBase()
           
 
Method Summary
 void add(Session session)
          Add this Session to the set of active Sessions for this Manager.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 void backgroundProcess()
          Implements the Manager interface, direct call to processExpires
 void changeSessionId(Session session)
          Change the session ID of the current session to a new randomly generated session ID.
 Session createEmptySession()
          Get a session from the recycled ones or create a new empty one.
 Session createSession()
          Deprecated.  
 Session createSession(java.lang.String sessionId)
          Construct and return a new session object, based on the default settings specified by this Manager's properties.
 void destroy()
           
 void expireSession(java.lang.String sessionId)
           
 Session findSession(java.lang.String id)
          Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
 Session[] findSessions()
          Return the set of active Sessions associated with this Manager.
protected  java.lang.String generateSessionId()
          Generate and return a new session identifier.
 int getActiveSessions()
          Returns the number of active sessions
 java.lang.String getAlgorithm()
          Return the message digest algorithm for this Manager.
 java.lang.String getClassName()
           
 Container getContainer()
          Return the Container with which this Manager is associated.
 java.lang.String getCreationTime(java.lang.String sessionId)
           
 long getCreationTimestamp(java.lang.String sessionId)
           
 java.security.MessageDigest getDigest()
          Return the MessageDigest object to be used for calculating session identifiers.
 boolean getDistributable()
          Deprecated. 
 java.lang.String getDomain()
           
 int getDuplicates()
          Number of duplicated session IDs generated by the random source.
 Engine getEngine()
          Retrieve the enclosing Engine for this Manager.
 java.lang.String getEntropy()
          Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.
 int getExpiredSessions()
          Gets the number of sessions that have expired.
 java.lang.String getInfo()
          Deprecated. 
 java.lang.String getJvmRoute()
          Retrieve the JvmRoute for the enclosing Engine.
 java.lang.String getLastAccessedTime(java.lang.String sessionId)
           
 long getLastAccessedTimestamp(java.lang.String sessionId)
           
 int getMaxActive()
          Max number of concurrent active sessions
 int getMaxInactiveInterval()
          Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.
 java.lang.String getName()
           
protected  StandardSession getNewSession()
          Get new session class to be used in the doLoad() method.
 javax.management.ObjectName getObjectName()
           
 int getProcessExpiresFrequency()
           
 long getProcessingTime()
           
 java.util.Random getRandom()
          Return the random number generator instance we should use for generating session identifiers.
protected  void getRandomBytes(byte[] bytes)
           
 java.lang.String getRandomClass()
          Return the random number generator class name.
 java.lang.String getRandomFile()
           
 java.util.HashMap<java.lang.String,java.lang.Object> getSession(java.lang.String sessionId)
          Returns information about the session with the given session id.
 java.lang.String getSessionAttribute(java.lang.String sessionId, java.lang.String key)
          For debugging.
 java.lang.String getSessionAttributeNameFilter()
          Obtain the regular expression used to filter session attribute based on attribute name.
protected  java.util.regex.Pattern getSessionAttributeNamePattern()
           
 java.lang.String getSessionAttributeValueClassNameFilter()
          Obtain the regular expression used to filter session attribute based on the implementation class of the value.
protected  java.util.regex.Pattern getSessionAttributeValueClassNamePattern()
          Provides getSessionAttributeValueClassNameFilter() as a pre-compiled regular expression pattern.
 int getSessionAverageAliveTime()
          Gets the average time (in seconds) that expired sessions had been alive.
 int getSessionCounter()
          Total sessions created by this manager.
 int getSessionCreateRate()
          Gets the current rate of session creation (in session per minute) based on the creation time of the previous 100 sessions created.
 int getSessionExpireRate()
          Gets the current rate of session expiration (in session per minute) based on the expiry time of the previous 100 sessions expired.
 int getSessionIdLength()
          Gets the session id length (in bytes) of Sessions created by this Manager.
 int getSessionMaxAliveTime()
          Gets the longest time (in seconds) that an expired session had been alive.
 boolean getWarnOnSessionAttributeFilterFailure()
          Should a warn level log message be generated if a session attribute is not persisted / replicated / restored.
 void init()
           
 java.lang.String listSessionIds()
          For debugging.
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
           
 void processExpires()
          Invalidate all sessions that have expired.
 void remove(Session session)
          Remove this Session from the active Sessions for this Manager.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener from this component.
 void setAlgorithm(java.lang.String algorithm)
          Set the message digest algorithm for this Manager.
 void setContainer(Container container)
          Set the Container with which this Manager is associated.
 void setDistributable(boolean distributable)
          Deprecated. 
 void setDuplicates(int duplicates)
           
 void setEntropy(java.lang.String entropy)
          Set the entropy increaser value.
 void setExpiredSessions(int expiredSessions)
          Sets the number of sessions that have expired.
 void setMaxActive(int maxActive)
          (Re)sets the maximum number of sessions that have been active at the same time.
 void setMaxInactiveInterval(int interval)
          Deprecated. 
 void setProcessExpiresFrequency(int processExpiresFrequency)
          Set the manager checks frequency.
 void setProcessingTime(long processingTime)
           
 void setRandomClass(java.lang.String randomClass)
          Set the random number generator class name.
 void setRandomFile(java.lang.String s)
          Use /dev/random-type special device.
 void setSessionAttributeNameFilter(java.lang.String sessionAttributeNameFilter)
           
 void setSessionAttributeValueClassNameFilter(java.lang.String sessionAttributeValueClassNameFilter)
          Set the regular expression to use to filter classes used for session attributes.
 void setSessionAverageAliveTime(int sessionAverageAliveTime)
          Sets the average time (in seconds) that expired sessions had been alive.
 void setSessionCounter(int sessionCounter)
          Sets the total number of sessions created by this manager.
 void setSessionIdLength(int idLength)
          Sets the session id length (in bytes) for Sessions created by this Manager.
 void setSessionMaxAliveTime(int sessionMaxAliveTime)
          Sets the longest time (in seconds) that an expired session had been alive.
 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.
 boolean willAttributeDistribute(java.lang.String name, java.lang.Object value)
          Would the Manager distribute the given session attribute? This implementation excludes session attributes from distribution if the: attribute name matches getSessionAttributeNameFilter()
 
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
getRejectedSessions, load, setRejectedSessions, unload
 

Field Detail

log

protected Log log

randomIS

protected java.io.DataInputStream randomIS

devRandomSource

protected java.lang.String devRandomSource

DEFAULT_ALGORITHM

protected static final java.lang.String DEFAULT_ALGORITHM
The default message digest algorithm to use if we cannot use the requested one.

See Also:
Constant Field Values

algorithm

protected java.lang.String algorithm
The message digest algorithm to be used when generating session identifiers. This must be an algorithm supported by the java.security.MessageDigest class on your platform.


container

protected Container container
The Container with which this Manager is associated.


digest

protected java.security.MessageDigest digest
Return the MessageDigest implementation to be used when creating session identifiers.


distributable

@Deprecated
protected boolean distributable
Deprecated. Ignored. Context.getDistributable() always takes precedence. Will be removed in Tomcat 9.0.x.
The distributable flag for Sessions created by this Manager. If this flag is set to true, any user attributes added to a session controlled by this Manager must be Serializable.


entropy

protected java.lang.String entropy
A String initialization parameter used to increase the entropy of the initialization of our random number generator.


maxInactiveInterval

@Deprecated
protected int maxInactiveInterval
Deprecated. Ignored. Context.getSessionTimeout() always takes precedence. Will be removed in Tomcat 9.0.x.
The default maximum inactive interval for Sessions created by this Manager.


sessionIdLength

protected int sessionIdLength
The session id length of Sessions created by this Manager.


name

protected static java.lang.String name
The descriptive name of this Manager implementation (for logging).


random

protected java.util.Random random
A random number generator to use when generating session identifiers.


randomClass

protected java.lang.String randomClass
The Java class name of the random number generator class to be used when generating session identifiers.


sessionMaxAliveTime

protected int sessionMaxAliveTime
The longest time (in seconds) that an expired session had been alive.


sessionAverageAliveTime

protected int sessionAverageAliveTime
Average time (in seconds) that expired sessions had been alive.


TIMING_STATS_CACHE_SIZE

protected static final int TIMING_STATS_CACHE_SIZE
See Also:
Constant Field Values

sessionCreationTiming

protected java.util.LinkedList<ManagerBase.SessionTiming> sessionCreationTiming

sessionExpirationTiming

protected java.util.LinkedList<ManagerBase.SessionTiming> sessionExpirationTiming

expiredSessions

protected int expiredSessions
Number of sessions that have expired.


sessions

protected java.util.Map<java.lang.String,Session> sessions
The set of currently active Sessions for this Manager, keyed by session identifier.


sessionCounter

protected int sessionCounter

maxActive

protected volatile int maxActive

duplicates

protected int duplicates

initialized

protected boolean initialized

processingTime

protected long processingTime
Processing time during session expiration.


processExpiresFrequency

protected int processExpiresFrequency
Frequency of the session expiration, and related manager operations. Manager operations will be done once for the specified amount of backgrondProcess calls (ie, the lower the amount, the most often the checks will occur).


sm

protected static final StringManager sm
The string manager for this package.


support

protected java.beans.PropertyChangeSupport support
The property change support for this component.


domain

protected java.lang.String domain

oname

protected javax.management.ObjectName oname

mserver

protected javax.management.MBeanServer mserver
Constructor Detail

ManagerBase

public ManagerBase()
Method Detail

getSessionAttributeNameFilter

public 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. null means no filter is applied. If an empty string is specified then no names will match the filter and all attributes will be blocked.

setSessionAttributeNameFilter

public void setSessionAttributeNameFilter(java.lang.String sessionAttributeNameFilter)

getSessionAttributeNamePattern

protected java.util.regex.Pattern getSessionAttributeNamePattern()

getSessionAttributeValueClassNameFilter

public 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. null means no filter is applied. If an empty string is specified then no names will match the filter and all attributes will be blocked.

getSessionAttributeValueClassNamePattern

protected java.util.regex.Pattern getSessionAttributeValueClassNamePattern()
Provides getSessionAttributeValueClassNameFilter() 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. null means no filter is applied.

setSessionAttributeValueClassNameFilter

public void setSessionAttributeValueClassNameFilter(java.lang.String sessionAttributeValueClassNameFilter)
                                             throws java.util.regex.PatternSyntaxException
Set 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 null if 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

getWarnOnSessionAttributeFilterFailure

public boolean getWarnOnSessionAttributeFilterFailure()
Should a warn level log message be generated if a session attribute is not persisted / replicated / restored.

Returns:
true if a warn level log message should be generated

setWarnOnSessionAttributeFilterFailure

public 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 - true if the warn level message should be generated

getAlgorithm

public java.lang.String getAlgorithm()
Return the message digest algorithm for this Manager.


setAlgorithm

public void setAlgorithm(java.lang.String algorithm)
Set the message digest algorithm for this Manager.

Parameters:
algorithm - The new message digest algorithm

getContainer

public Container getContainer()
Return the Container with which this Manager is associated.

Specified by:
getContainer in interface Manager

setContainer

public void setContainer(Container container)
Description copied from interface: Manager
Set the Container with which this Manager is associated. The Container 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 Container (including setting a null value) that the Manager is associated with.

Specified by:
setContainer in interface Manager
Parameters:
container - The newly associated Container

getClassName

public java.lang.String getClassName()
Returns:
The name of the implementation class.

getDigest

public java.security.MessageDigest getDigest()
Return the MessageDigest object to be used for calculating session identifiers. If none has been created yet, initialize one the first time this method is called.


getDistributable

@Deprecated
public boolean getDistributable()
Deprecated. 

Return the distributable flag for the sessions supported by this Manager.

Specified by:
getDistributable in interface Manager

setDistributable

@Deprecated
public void setDistributable(boolean distributable)
Deprecated. 

Description copied from interface: Manager
Set the distributable flag for the sessions supported by this Manager. If this flag is set, all user data objects added to sessions associated with this manager must implement Serializable.

Specified by:
setDistributable in interface Manager
Parameters:
distributable - The new distributable flag

getEntropy

public java.lang.String getEntropy()
Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.


setEntropy

public void setEntropy(java.lang.String entropy)
Set the entropy increaser value.

Parameters:
entropy - The new entropy increaser value

getInfo

@Deprecated
public java.lang.String getInfo()
Deprecated. 

Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface Manager

getMaxInactiveInterval

public int getMaxInactiveInterval()
Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.

Specified by:
getMaxInactiveInterval in interface Manager

setMaxInactiveInterval

@Deprecated
public void setMaxInactiveInterval(int interval)
Deprecated. 

Description copied from interface: Manager
Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.

Specified by:
setMaxInactiveInterval in interface Manager
Parameters:
interval - The new default value

getSessionIdLength

public int getSessionIdLength()
Gets the session id length (in bytes) of Sessions created by this Manager.

Specified by:
getSessionIdLength in interface Manager
Returns:
The session id length

setSessionIdLength

public void setSessionIdLength(int idLength)
Sets the session id length (in bytes) for Sessions created by this Manager.

Specified by:
setSessionIdLength in interface Manager
Parameters:
idLength - The session id length

getName

public java.lang.String getName()
Returns:
The descriptive short name of this Manager implementation.

setRandomFile

public void setRandomFile(java.lang.String s)
Use /dev/random-type special device. This is new code, but may reduce the big delay in generating the random. You must specify a path to a random generator file. Use /dev/urandom for linux ( or similar ) systems. Use /dev/random for maximum security ( it may block if not enough "random" exist ). You can also use a pipe that generates random. The code will check if the file exists, and default to java Random if not found. There is a significant performance difference, very visible on the first call to getSession ( like in the first JSP ) - so use it if available.


getRandomFile

public java.lang.String getRandomFile()

getRandom

public java.util.Random getRandom()
Return the random number generator instance we should use for generating session identifiers. If there is no such generator currently defined, construct and seed a new one.


getRandomClass

public java.lang.String getRandomClass()
Return the random number generator class name.


setRandomClass

public void setRandomClass(java.lang.String randomClass)
Set the random number generator class name.

Parameters:
randomClass - The new random number generator class name

getExpiredSessions

public int getExpiredSessions()
Gets the number of sessions that have expired.

Specified by:
getExpiredSessions in interface Manager
Returns:
Number of sessions that have expired

setExpiredSessions

public void setExpiredSessions(int expiredSessions)
Sets the number of sessions that have expired.

Specified by:
setExpiredSessions in interface Manager
Parameters:
expiredSessions - Number of sessions that have expired

getProcessingTime

public long getProcessingTime()

setProcessingTime

public void setProcessingTime(long processingTime)

getProcessExpiresFrequency

public int getProcessExpiresFrequency()
Returns:
The frequency of manager checks.

setProcessExpiresFrequency

public void setProcessExpiresFrequency(int processExpiresFrequency)
Set the manager checks frequency.

Parameters:
processExpiresFrequency - the new manager checks frequency

backgroundProcess

public void backgroundProcess()
Implements the Manager interface, direct call to processExpires

Specified by:
backgroundProcess in interface Manager

processExpires

public void processExpires()
Invalidate all sessions that have expired.


destroy

public void destroy()

init

public void init()

add

public void add(Session session)
Add this Session to the set of active Sessions for this Manager.

Specified by:
add in interface Manager
Parameters:
session - Session to be added

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.

Specified by:
addPropertyChangeListener in interface Manager
Parameters:
listener - The listener to add

createSession

@Deprecated
public Session createSession()
Deprecated. 

Construct and return a new session object, based on the default settings specified by this Manager's properties. The session id will be assigned by this method, and available via the getId() method of the returned session. If a new session cannot be created for any reason, return null.

Specified by:
createSession in interface Manager
Throws:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

createSession

public Session createSession(java.lang.String sessionId)
Construct 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, return null.

Specified by:
createSession in interface Manager
Parameters:
sessionId - The session id which should be used to create the new session; if null, a new session id will be generated
Throws:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason

createEmptySession

public Session createEmptySession()
Get 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:
createEmptySession in interface Manager

findSession

public Session findSession(java.lang.String id)
                    throws java.io.IOException
Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.

Specified by:
findSession in interface Manager
Parameters:
id - The session id for the session to be returned
Throws:
java.lang.IllegalStateException - if a new session cannot be instantiated for any reason
java.io.IOException - if an input/output error occurs while processing this request

findSessions

public 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:
findSessions in interface Manager

remove

public void remove(Session session)
Remove this Session from the active Sessions for this Manager.

Specified by:
remove in interface Manager
Parameters:
session - Session to be removed

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.

Specified by:
removePropertyChangeListener in interface Manager
Parameters:
listener - The listener to remove

changeSessionId

public void changeSessionId(Session session)
Change the session ID of the current session to a new randomly generated session ID.

Specified by:
changeSessionId in interface Manager
Parameters:
session - The session to change the session ID for

willAttributeDistribute

public 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:

Specified by:
willAttributeDistribute in interface Manager
Parameters:
name - The attribute name
value - The attribute value
Returns:
true if the Manager would distribute the given attribute otherwise false

getNewSession

protected StandardSession getNewSession()
Get new session class to be used in the doLoad() method.


getRandomBytes

protected void getRandomBytes(byte[] bytes)

generateSessionId

protected java.lang.String generateSessionId()
Generate and return a new session identifier.


getEngine

public Engine getEngine()
Retrieve the enclosing Engine for this Manager.

Returns:
an Engine object (or null).

getJvmRoute

public java.lang.String getJvmRoute()
Retrieve the JvmRoute for the enclosing Engine.

Returns:
the JvmRoute or null.

setSessionCounter

public void setSessionCounter(int sessionCounter)
Description copied from interface: Manager
Sets the total number of sessions created by this manager.

Specified by:
setSessionCounter in interface Manager
Parameters:
sessionCounter - Total number of sessions created by this manager.

getSessionCounter

public int getSessionCounter()
Total sessions created by this manager.

Specified by:
getSessionCounter in interface Manager
Returns:
sessions created

getDuplicates

public int getDuplicates()
Number of duplicated session IDs generated by the random source. Anything bigger than 0 means problems.

Returns:
The count of duplicates

setDuplicates

public void setDuplicates(int duplicates)

getActiveSessions

public int getActiveSessions()
Returns the number of active sessions

Specified by:
getActiveSessions in interface Manager
Returns:
number of sessions active

getMaxActive

public int getMaxActive()
Max number of concurrent active sessions

Specified by:
getMaxActive in interface Manager
Returns:
The highest number of concurrent active sessions

setMaxActive

public 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:
setMaxActive in interface Manager
Parameters:
maxActive - Maximum number of sessions that have been active at the same time.

getSessionMaxAliveTime

public int getSessionMaxAliveTime()
Gets the longest time (in seconds) that an expired session had been alive.

Specified by:
getSessionMaxAliveTime in interface Manager
Returns:
Longest time (in seconds) that an expired session had been alive.

setSessionMaxAliveTime

public void setSessionMaxAliveTime(int sessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.

Specified by:
setSessionMaxAliveTime in interface Manager
Parameters:
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:
getSessionAverageAliveTime in interface Manager
Returns:
Average time (in seconds) that expired sessions had been alive.

setSessionAverageAliveTime

public void setSessionAverageAliveTime(int sessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.

Specified by:
setSessionAverageAliveTime in interface Manager
Parameters:
sessionAverageAliveTime - Average time (in seconds) that expired sessions had been alive.

getSessionCreateRate

public int getSessionCreateRate()
Gets the current rate of session creation (in session per minute) 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.

Returns:
The current rate (in sessions per minute) of session creation

getSessionExpireRate

public int getSessionExpireRate()
Gets the current rate of session expiration (in session per minute) based on the expiry time of the previous 100 sessions expired. If less than 100 sessions have expired then all available data is used.

Returns:
The current rate (in sessions per minute) of session expiration

listSessionIds

public java.lang.String listSessionIds()
For debugging.

Returns:
A space separated list of all session IDs currently active

getSessionAttribute

public 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

getSession

public java.util.HashMap<java.lang.String,java.lang.Object> 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

expireSession

public void expireSession(java.lang.String sessionId)

getLastAccessedTimestamp

public long getLastAccessedTimestamp(java.lang.String sessionId)

getLastAccessedTime

public java.lang.String getLastAccessedTime(java.lang.String sessionId)

getCreationTime

public java.lang.String getCreationTime(java.lang.String sessionId)

getCreationTimestamp

public long getCreationTimestamp(java.lang.String sessionId)

getObjectName

public javax.management.ObjectName getObjectName()

getDomain

public java.lang.String getDomain()

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

Apache Tomcat 6.0.53

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.