Home » apache-tomcat-6.0.26-src » org.apache » catalina » session » [javadoc | source]
org.apache.catalina.session
abstract public class: ManagerBase [javadoc | source]
java.lang.Object
   org.apache.catalina.session.ManagerBase

All Implemented Interfaces:
    Manager, MBeanRegistration

Direct Known Subclasses:
    SimpleTcpReplicationManager, SimpleTcpReplicationManager, PersistentManagerBase, MockDeltaManager, DeltaManager, BackupManager, StandardManager, ClusterManagerBase, PersistentManager, DeltaManager

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  Log log     
protected  DataInputStream randomIS     
protected  String devRandomSource     
protected static final  String DEFAULT_ALGORITHM    The default message digest algorithm to use if we cannot use the requested one. 
protected  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. 
protected  Container container    The Container with which this Manager is associated. 
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. If this flag is set to true, any user attributes added to a session controlled by this Manager must be Serializable. 
protected  String entropy    A String initialization parameter used to increase the entropy of the initialization of our random number generator. 
protected  int maxInactiveInterval    The default maximum inactive interval for Sessions created by this Manager. 
protected  int sessionIdLength    The session id length of Sessions created by this Manager. 
protected static  String name    The descriptive name of this Manager implementation (for logging). 
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  int sessionMaxAliveTime    The longest time (in seconds) that an expired session had been alive. 
protected  int sessionAverageAliveTime    Average time (in seconds) that expired sessions had been alive. 
protected  int expiredSessions    Number of sessions that have expired. 
protected  Map<String, Session> sessions    The set of currently active Sessions for this Manager, keyed by session identifier. 
protected  int sessionCounter     
protected  int maxActive     
protected  int duplicates     
protected  boolean initialized     
protected  long processingTime    Processing time during session expiration. 
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). 
protected static  StringManager sm    The string manager for this package. 
protected  PropertyChangeSupport support    The property change support for this component. 
protected  String domain     
protected  ObjectName oname     
protected  MBeanServer mserver     
Method from org.apache.catalina.session.ManagerBase Summary:
add,   addPropertyChangeListener,   backgroundProcess,   changeSessionId,   createEmptySession,   createSession,   createSession,   destroy,   expireSession,   findSession,   findSessions,   generateSessionId,   getActiveSessions,   getAlgorithm,   getClassName,   getContainer,   getCreationTime,   getCreationTimestamp,   getDigest,   getDistributable,   getDomain,   getDuplicates,   getEngine,   getEntropy,   getExpiredSessions,   getInfo,   getJvmRoute,   getLastAccessedTime,   getLastAccessedTimestamp,   getMaxActive,   getMaxInactiveInterval,   getName,   getNewSession,   getObjectName,   getProcessExpiresFrequency,   getProcessingTime,   getRandom,   getRandomBytes,   getRandomClass,   getRandomFile,   getSession,   getSessionAttribute,   getSessionAverageAliveTime,   getSessionCounter,   getSessionIdLength,   getSessionMaxAliveTime,   init,   listSessionIds,   postDeregister,   postRegister,   preDeregister,   preRegister,   processExpires,   remove,   removePropertyChangeListener,   setAlgorithm,   setContainer,   setDistributable,   setDuplicates,   setEntropy,   setExpiredSessions,   setMaxActive,   setMaxInactiveInterval,   setProcessExpiresFrequency,   setProcessingTime,   setRandomClass,   setRandomFile,   setSessionAverageAliveTime,   setSessionCounter,   setSessionIdLength,   setSessionMaxAliveTime
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.session.ManagerBase Detail:
 public  void add(Session session) 
    Add this Session to the set of active Sessions for this Manager.
 public  void addPropertyChangeListener(PropertyChangeListener listener) 
    Add a property change listener to this component.
 public  void backgroundProcess() 
    Implements the Manager interface, direct call to processExpires
 public  void changeSessionId(Session session) 
    Change the session ID of the current session to a new randomly generated session ID.
 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.
 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.
 public Session createSession(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.
 public  void destroy() 
 public  void expireSession(String sessionId) 
 public Session findSession(String id) throws IOException 
    Return the active Session, associated with this Manager, with the specified session id (if any); otherwise return null.
 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.
 protected synchronized String generateSessionId() 
    Generate and return a new session identifier.
 public int getActiveSessions() 
    Returns the number of active sessions
 public String getAlgorithm() 
    Return the message digest algorithm for this Manager.
 public String getClassName() 
    Returns the name of the implementation class.
 public Container getContainer() 
    Return the Container with which this Manager is associated.
 public String getCreationTime(String sessionId) 
 public long getCreationTimestamp(String sessionId) 
 public synchronized 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.
 public boolean getDistributable() 
    Return the distributable flag for the sessions supported by this Manager.
 public String getDomain() 
 public int getDuplicates() 
    Number of duplicated session IDs generated by the random source. Anything bigger than 0 means problems.
 public Engine getEngine() 
    Retrieve the enclosing Engine for this Manager.
 public String getEntropy() 
    Return the entropy increaser value, or compute a semi-useful value if this String has not yet been set.
 public int getExpiredSessions() 
    Gets the number of sessions that have expired.
 public String getInfo() 
    Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
 public String getJvmRoute() 
    Retrieve the JvmRoute for the enclosing Engine.
 public String getLastAccessedTime(String sessionId) 
 public long getLastAccessedTimestamp(String sessionId) 
 public int getMaxActive() 
    Max number of concurrent active sessions
 public int getMaxInactiveInterval() 
    Return the default maximum inactive interval (in seconds) for Sessions created by this Manager.
 public 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.
 public ObjectName getObjectName() 
 public int getProcessExpiresFrequency() 
    Return the frequency of manager checks.
 public long getProcessingTime() 
 public 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.
 protected  void getRandomBytes(byte[] bytes) 
 public String getRandomClass() 
    Return the random number generator class name.
 public String getRandomFile() 
 public HashMap getSession(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.

 public String getSessionAttribute(String sessionId,
    String key) 
    For debugging: get a session attribute
 public int getSessionAverageAliveTime() 
    Gets the average time (in seconds) that expired sessions had been alive.
 public int getSessionCounter() 
    Total sessions created by this manager.
 public int getSessionIdLength() 
    Gets the session id length (in bytes) of Sessions created by this Manager.
 public int getSessionMaxAliveTime() 
    Gets the longest time (in seconds) that an expired session had been alive.
 public  void init() 
 public String listSessionIds() 
    For debugging: return a list of all session ids currently active
 public  void postDeregister() 
 public  void postRegister(Boolean registrationDone) 
 public  void preDeregister() throws Exception 
 public ObjectName preRegister(MBeanServer server,
    ObjectName name) throws Exception 
 public  void processExpires() 
    Invalidate all sessions that have expired.
 public  void remove(Session session) 
    Remove this Session from the active Sessions for this Manager.
 public  void removePropertyChangeListener(PropertyChangeListener listener) 
    Remove a property change listener from this component.
 public  void setAlgorithm(String algorithm) 
    Set the message digest algorithm for this Manager.
 public  void setContainer(Container container) 
    Set the Container with which this Manager is associated.
 public  void setDistributable(boolean distributable) 
    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.
 public  void setDuplicates(int duplicates) 
 public  void setEntropy(String entropy) 
    Set the entropy increaser value.
 public  void setExpiredSessions(int expiredSessions) 
    Sets the number of sessions that have expired.
 public  void setMaxActive(int maxActive) 
 public  void setMaxInactiveInterval(int interval) 
    Set the default maximum inactive interval (in seconds) for Sessions created by this Manager.
 public  void setProcessExpiresFrequency(int processExpiresFrequency) 
    Set the manager checks frequency.
 public  void setProcessingTime(long processingTime) 
 public  void setRandomClass(String randomClass) 
    Set the random number generator class name.
 public  void setRandomFile(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.
 public  void setSessionAverageAliveTime(int sessionAverageAliveTime) 
    Sets the average time (in seconds) that expired sessions had been alive.
 public  void setSessionCounter(int sessionCounter) 
 public  void setSessionIdLength(int idLength) 
    Sets the session id length (in bytes) for Sessions created by this Manager.
 public  void setSessionMaxAliveTime(int sessionMaxAliveTime) 
    Sets the longest time (in seconds) that an expired session had been alive.