|
Apache Tomcat 7.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.session.ManagerBase
public abstract class ManagerBase
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.
Field Summary | |
---|---|
protected 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 String |
DEFAULT_ALGORITHM
The default message digest algorithm to use if we cannot use the requested one. |
protected String |
devRandomSource
|
protected MessageDigest |
digest
Return the MessageDigest implementation to be used when creating session identifiers. |
protected boolean |
distributable
The distributable flag for Sessions created by this Manager. |
protected int |
duplicates
|
protected String |
entropy
A String initialization parameter used to increase the entropy of the initialization of our random number generator. |
protected long |
expiredSessions
Number of sessions that have expired. |
protected int |
maxActive
|
protected int |
maxActiveSessions
The maximum number of active Sessions allowed, or -1 for no limit. |
protected int |
maxInactiveInterval
The default maximum inactive interval for Sessions created by this Manager. |
protected static String |
name
The descriptive name of this Manager implementation (for logging). |
protected int |
processExpiresFrequency
Frequency of the session expiration, and related manager operations. |
protected long |
processingTime
Processing time during session expiration. |
protected Random |
random
A random number generator to use when generating session identifiers. |
protected String |
randomClass
The Java class name of the random number generator class to be used when generating session identifiers. |
protected DataInputStream |
randomIS
|
protected int |
rejectedSessions
Number of session creations that failed due to maxActiveSessions. |
protected int |
sessionAverageAliveTime
Average time (in seconds) that expired sessions had been alive. |
protected long |
sessionCounter
|
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 Map<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 PropertyChangeSupport |
support
The property change support for this component. |
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase |
---|
mserver |
Fields inherited from interface org.apache.catalina.Lifecycle |
---|
AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, DESTROY_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
---|---|
ManagerBase()
|
Method Summary | |
---|---|
void |
add(Session session)
Add this Session to the set of active Sessions for this Manager. |
void |
addPropertyChangeListener(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(String sessionId)
Construct and return a new session object, based on the default settings specified by this Manager's properties. |
protected void |
destroyInternal()
Sub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method. |
void |
expireSession(String sessionId)
|
Session |
findSession(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 String |
generateSessionId()
Generate and return a new session identifier. |
int |
getActiveSessions()
Returns the number of active sessions |
String |
getAlgorithm()
Return the message digest algorithm for this Manager. |
String |
getClassName()
Returns the name of the implementation class. |
Container |
getContainer()
Return the Container with which this Manager is associated. |
String |
getCreationTime(String sessionId)
|
long |
getCreationTimestamp(String sessionId)
|
MessageDigest |
getDigest()
Return the MessageDigest object to be used for calculating session identifiers. |
boolean |
getDistributable()
Return the distributable flag for the sessions supported by this Manager. |
String |
getDomainInternal()
Method implemented by sub-classes to identify the domain in which MBeans should be registered. |
int |
getDuplicates()
Number of duplicated session IDs generated by the random source. |
Engine |
getEngine()
Retrieve the enclosing Engine for this Manager. |
String |
getEntropy()
Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set. |
long |
getExpiredSessions()
Gets the number of sessions that have expired. |
String |
getInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version> . |
String |
getJvmRoute()
Retrieve the JvmRoute for the enclosing Engine. |
String |
getLastAccessedTime(String sessionId)
|
long |
getLastAccessedTimestamp(String sessionId)
|
int |
getMaxActive()
Max number of concurrent active sessions |
int |
getMaxActiveSessions()
Return the maximum number of active Sessions allowed, or -1 for no limit. |
int |
getMaxInactiveInterval()
Return the default maximum inactive interval (in seconds) for Sessions created by this Manager. |
String |
getName()
Return the descriptive short name of this Manager implementation. |
protected StandardSession |
getNewSession()
Get new session class to be used in the doLoad() method. |
String |
getObjectNameKeyProperties()
Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component. |
int |
getProcessExpiresFrequency()
Return the frequency of manager checks. |
long |
getProcessingTime()
|
Random |
getRandom()
Return the random number generator instance we should use for generating session identifiers. |
protected void |
getRandomBytes(byte[] bytes)
|
String |
getRandomClass()
Return the random number generator class name. |
String |
getRandomFile()
|
int |
getRejectedSessions()
Number of session creations that failed due to maxActiveSessions |
HashMap<String,String> |
getSession(String sessionId)
Returns information about the session with the given session id. |
String |
getSessionAttribute(String sessionId,
String key)
For debugging: get a session attribute |
int |
getSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been alive. |
long |
getSessionCounter()
Total sessions created by this manager. |
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. |
String |
getThisAccessedTime(String sessionId)
|
long |
getThisAccessedTimestamp(String sessionId)
|
protected void |
initInternal()
Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method. |
String |
listSessionIds()
For debugging: return a list of all session ids currently active |
void |
processExpires()
Invalidate all sessions that have expired. |
void |
propertyChange(PropertyChangeEvent event)
Process property change events from our associated Context. |
void |
remove(Session session)
Remove this Session from the active Sessions for this Manager. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component. |
void |
setAlgorithm(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)
Set the distributable flag for the sessions supported by this Manager. |
void |
setDuplicates(int duplicates)
|
void |
setEntropy(String entropy)
Set the entropy increaser value. |
void |
setExpiredSessions(long 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 |
setMaxActiveSessions(int max)
Set the maximum number of active Sessions allowed, or -1 for no limit. |
void |
setMaxInactiveInterval(int interval)
Set the default maximum inactive interval (in seconds) for Sessions created by this Manager. |
void |
setProcessExpiresFrequency(int processExpiresFrequency)
Set the manager checks frequency. |
void |
setProcessingTime(long processingTime)
|
void |
setRandomClass(String randomClass)
Set the random number generator class name. |
void |
setRandomFile(String s)
Use /dev/random-type special device. |
void |
setSessionAverageAliveTime(int sessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive. |
void |
setSessionCounter(long 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. |
String |
toString()
Return a String rendering of this object. |
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase |
---|
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister |
Methods inherited from class org.apache.catalina.util.LifecycleBase |
---|
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, startInternal, stop, stopInternal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.catalina.Manager |
---|
load, unload |
Field Detail |
---|
protected DataInputStream randomIS
protected String devRandomSource
protected static final String DEFAULT_ALGORITHM
protected String algorithm
java.security.MessageDigest
class on your platform.
protected Container container
protected MessageDigest digest
protected boolean distributable
true
, any user attributes added to a
session controlled by this Manager must be Serializable.
protected String entropy
protected int maxInactiveInterval
protected int sessionIdLength
protected static String name
protected Random random
protected String randomClass
protected int sessionMaxAliveTime
protected int sessionAverageAliveTime
protected long expiredSessions
protected Map<String,Session> sessions
protected long sessionCounter
protected volatile int maxActive
protected int maxActiveSessions
protected int rejectedSessions
protected volatile int duplicates
protected long processingTime
protected int processExpiresFrequency
protected static final StringManager sm
protected PropertyChangeSupport support
Constructor Detail |
---|
public ManagerBase()
Method Detail |
---|
public String getAlgorithm()
public void setAlgorithm(String algorithm)
algorithm
- The new message digest algorithmpublic Container getContainer()
getContainer
in interface Manager
public void setContainer(Container container)
setContainer
in interface Manager
container
- The newly associated Containerpublic String getClassName()
public MessageDigest getDigest()
public boolean getDistributable()
getDistributable
in interface Manager
public void setDistributable(boolean distributable)
setDistributable
in interface Manager
distributable
- The new distributable flagpublic String getEntropy()
public void setEntropy(String entropy)
entropy
- The new entropy increaser valuepublic String getInfo()
<description>/<version>
.
getInfo
in interface Manager
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface Manager
public void setMaxInactiveInterval(int interval)
setMaxInactiveInterval
in interface Manager
interval
- The new default valuepublic int getSessionIdLength()
getSessionIdLength
in interface Manager
public void setSessionIdLength(int idLength)
setSessionIdLength
in interface Manager
idLength
- The session id lengthpublic String getName()
public void setRandomFile(String s)
public String getRandomFile()
public Random getRandom()
public String getRandomClass()
public void setRandomClass(String randomClass)
randomClass
- The new random number generator class namepublic int getRejectedSessions()
getRejectedSessions
in interface Manager
public long getExpiredSessions()
getExpiredSessions
in interface Manager
public void setExpiredSessions(long expiredSessions)
setExpiredSessions
in interface Manager
expiredSessions
- Number of sessions that have expiredpublic long getProcessingTime()
public void setProcessingTime(long processingTime)
public int getProcessExpiresFrequency()
public void setProcessExpiresFrequency(int processExpiresFrequency)
processExpiresFrequency
- the new manager checks frequencypublic void backgroundProcess()
backgroundProcess
in interface Manager
public void processExpires()
protected void destroyInternal() throws LifecycleException
LifecycleMBeanBase
destroyInternal
in class LifecycleMBeanBase
LifecycleException
protected void initInternal() throws LifecycleException
LifecycleMBeanBase
initInternal
in class LifecycleMBeanBase
LifecycleException
public void add(Session session)
add
in interface Manager
session
- Session to be addedpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Manager
listener
- The listener to addpublic Session createSession(String sessionId)
null
.
createSession
in interface Manager
sessionId
- The session id which should be used to create the
new session; if null
, a new session id will be
generated
IllegalStateException
- if a new session cannot be
instantiated for any reasonpublic Session createEmptySession()
createEmptySession
in interface Manager
public Session findSession(String id) throws IOException
null
.
findSession
in interface Manager
id
- The session id for the session to be returned
IllegalStateException
- if a new session cannot be
instantiated for any reason
IOException
- if an input/output error occurs while
processing this requestpublic Session[] findSessions()
findSessions
in interface Manager
public void remove(Session session)
remove
in interface Manager
session
- Session to be removedpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Manager
listener
- The listener to removepublic void changeSessionId(Session session)
changeSessionId
in interface Manager
session
- The session to change the session ID forprotected StandardSession getNewSession()
protected void getRandomBytes(byte[] bytes)
protected String generateSessionId()
public Engine getEngine()
public String getJvmRoute()
public void setSessionCounter(long sessionCounter)
Manager
setSessionCounter
in interface Manager
sessionCounter
- Total number of sessions created by this manager.public long getSessionCounter()
getSessionCounter
in interface Manager
public int getDuplicates()
public void setDuplicates(int duplicates)
public int getActiveSessions()
getActiveSessions
in interface Manager
public int getMaxActive()
getMaxActive
in interface Manager
public void setMaxActive(int maxActive)
Manager
setMaxActive
in interface Manager
maxActive
- Maximum number of sessions that have been active at
the same time.public int getMaxActiveSessions()
public void setMaxActiveSessions(int max)
max
- The new maximum number of sessionspublic int getSessionMaxAliveTime()
getSessionMaxAliveTime
in interface Manager
public void setSessionMaxAliveTime(int sessionMaxAliveTime)
setSessionMaxAliveTime
in interface Manager
sessionMaxAliveTime
- Longest time (in seconds) that an expired
session had been alive.public int getSessionAverageAliveTime()
getSessionAverageAliveTime
in interface Manager
public void setSessionAverageAliveTime(int sessionAverageAliveTime)
setSessionAverageAliveTime
in interface Manager
sessionAverageAliveTime
- Average time (in seconds) that expired
sessions had been alive.public String listSessionIds()
public String getSessionAttribute(String sessionId, String key)
sessionId
- key
-
public HashMap<String,String> getSession(String sessionId)
The session information is organized as a HashMap, mapping session attribute names to the String representation of their values.
sessionId
- Session id
public void expireSession(String sessionId)
public long getThisAccessedTimestamp(String sessionId)
public String getThisAccessedTime(String sessionId)
public long getLastAccessedTimestamp(String sessionId)
public String getLastAccessedTime(String sessionId)
public String getCreationTime(String sessionId)
public long getCreationTimestamp(String sessionId)
public String toString()
toString
in class Object
public String getObjectNameKeyProperties()
LifecycleMBeanBase
ObjectName
that will be used to register this component.
getObjectNameKeyProperties
in class LifecycleMBeanBase
ObjectName
public String getDomainInternal()
LifecycleMBeanBase
getDomainInternal
in class LifecycleMBeanBase
public void propertyChange(PropertyChangeEvent event)
propertyChange
in interface PropertyChangeListener
event
- The property change event that has occurred
|
Apache Tomcat 7.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |