StandardManager (Catalina Internal API Documentation)
Keywords: org.apache.catalina.session.StandardManager class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.session
Class StandardManager

    java.lang.Object
      org.apache.catalina.session.ManagerBase
          org.apache.catalina.session.StandardManager

All Implemented Interfaces:
  java.util.EventListener, Lifecycle, Manager, java.beans.PropertyChangeListener, java.lang.Runnable

public class StandardManager
extends ManagerBase
implements Lifecycle, java.beans.PropertyChangeListener, java.lang.Runnable

Standard implementation of the Manager interface that provides simple session persistence across restarts of this component (such as when the entire server is shut down and restarted, or when a particular web application is reloaded.

IMPLEMENTATION NOTE: Correct behavior of session storing and reloading depends upon external calls to the `start()` and `stop()` methods of this class at the correct times.

Version:
  $Revision: 434283 $ $Date: 2006-08-23 21:57:51 -0400 (Wed, 23 Aug 2006) $
Author:
  Craig R. McClanahan

Field Summary
`protected LifecycleSupport` | `lifecycle` The lifecycle event support for this component.
`protected static java.lang.String` | `name` The descriptive name of this Manager implementation (for logging).

Fields inherited from class org.apache.catalina.session.ManagerBase
`algorithm, container, debug, DEFAULT_ALGORITHM, defaultContext, digest, distributable, duplicates, entropy, maxActive, maxInactiveInterval, random, randomClass, recycled, SESSION_ID_BYTES, sessionCounter, sessions, sm, support`

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`StandardManager()`

Method Summary
`void` | `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`Session` | `createSession()` Construct and return a new session object, based on the default settings specified by this Manager's properties.
`LifecycleListener[]` | `findLifecycleListeners()` Get the lifecycle listeners associated with this lifecycle.
`int` | `getCheckInterval()` Return the check interval (in seconds) for this Manager.
`int` | `getExpiredSessions()` Number of sessions that expired.
`java.lang.String` | `getInfo()` Return descriptive information about this Manager implementation and the corresponding version number, in the format `<description>/<version>`.
`int` | `getMaxActiveSessions()` Return the maximum number of active Sessions allowed, or -1 for no limit.
`java.lang.String` | `getName()` Return the descriptive short name of this Manager implementation.
`java.lang.String` | `getPathname()` Return the session persistence pathname, if any.
`int` | `getRejectedSessions()` Number of session creations that failed due to maxActiveSessions.
`void` | `load()` Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any.
`void` | `propertyChange(java.beans.PropertyChangeEvent event)` Process property change events from our associated Context.
`void` | `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` | `run()` The background thread that checks for session timeouts and shutdown.
`void` | `setCheckInterval(int checkInterval)` Set the check interval (in seconds) for this Manager.
`void` | `setContainer(Container container)` Set the Container with which this Manager has been associated.
`void` | `setExpiredSessions(int expiredSessions)`
`void` | `setMaxActiveSessions(int max)` Set the maximum number of actives Sessions allowed, or -1 for no limit.
`void` | `setPathname(java.lang.String pathname)` Set the session persistence pathname to the specified value.
`void` | `setRejectedSessions(int rejectedSessions)`
`void` | `start()` Prepare for the beginning of active use of the public methods of this component.
`void` | `stop()` Gracefully terminate the active use of the public methods of this component.
`void` | `unload()` Save any currently active sessions in the appropriate persistence mechanism, if any.

Methods inherited from class org.apache.catalina.session.ManagerBase
`add, addPropertyChangeListener, createEmptySession, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getAlgorithm, getContainer, getDebug, getDefaultContext, getDigest, getDistributable, getDuplicates, getEngine, getEntropy, getJvmRoute, getLastAccessedTime, getMaxActive, getMaxInactiveInterval, getRandom, getRandomClass, getSessionAttribute, getSessionCounter, listSessionIds, remove, removePropertyChangeListener, setAlgorithm, setDebug, setDefaultContext, setDistributable, setDuplicates, setEntropy, setMaxActive, setMaxInactiveInterval, setRandomClass, setSessionCounter`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### lifecycle

    protected LifecycleSupport lifecycle

  The lifecycle event support for this component.

### name

    protected static java.lang.String name

  The descriptive name of this Manager implementation (for logging).

Constructor Detail

### StandardManager

    public StandardManager()

Method Detail

### getCheckInterval

    public int getCheckInterval()

  Return the check interval (in seconds) for this Manager.

### setCheckInterval

    public void setCheckInterval(int checkInterval)

  Set the check interval (in seconds) for this Manager.

  Parameters:
    `checkInterval` - The new check interval

### setContainer

    public void setContainer(Container container)

  Set the Container with which this Manager has been associated. If it is a Context (the usual case), listen for changes to the session timeout property.

  Specified by:
    `setContainer` in interface `Manager`
  Overrides:
    `setContainer` in class `ManagerBase`
  Parameters:
    `container` - The associated Container

### getInfo

    public java.lang.String getInfo()

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

  Specified by:
    `getInfo` in interface `Manager`
  Overrides:
    `getInfo` in class `ManagerBase`

### getMaxActiveSessions

    public int getMaxActiveSessions()

  Return the maximum number of active Sessions allowed, or -1 for no limit.

### getRejectedSessions

    public int getRejectedSessions()

  Number of session creations that failed due to maxActiveSessions.

### setRejectedSessions

    public void setRejectedSessions(int rejectedSessions)

### getExpiredSessions

    public int getExpiredSessions()

  Number of sessions that expired.

### setExpiredSessions

    public void setExpiredSessions(int expiredSessions)

### setMaxActiveSessions

    public void setMaxActiveSessions(int max)

  Set the maximum number of actives Sessions allowed, or -1 for no limit.

  Parameters:
    `max` - The new maximum number of sessions

### getName

    public java.lang.String getName()

  Return the descriptive short name of this Manager implementation.

  Overrides:
    `getName` in class `ManagerBase`

### getPathname

    public java.lang.String getPathname()

  Return the session persistence pathname, if any.

### setPathname

    public void setPathname(java.lang.String pathname)

  Set the session persistence pathname to the specified value. If no persistence support is desired, set the pathname to `null`.

  Parameters:
    `pathname` - New session persistence pathname

### createSession

    public Session createSession()

  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`
  Overrides:
    `createSession` in class `ManagerBase`
  Throws:
    `java.lang.IllegalStateException` - if a new session cannot be instantiated for any reason

### load

    public void load()
              throws java.lang.ClassNotFoundException,
                     java.io.IOException

  Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

  Specified by:
    `load` in interface `Manager`
  Throws:
    `java.lang.ClassNotFoundException` - if a serialized class cannot be found during the reload
    `java.io.IOException` - if an input/output error occurs

### unload

    public void unload()
                throws java.io.IOException

  Save any currently active sessions in the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

  Specified by:
    `unload` in interface `Manager`
  Throws:
    `java.io.IOException` - if an input/output error occurs

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

  Add a lifecycle event listener to this component.

  Specified by:
    `addLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### findLifecycleListeners

    public LifecycleListener[] findLifecycleListeners()

  Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

  Specified by:
    `findLifecycleListeners` in interface `Lifecycle`

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

  Remove a lifecycle event listener from this component.

  Specified by:
    `removeLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to remove

### start

    public void start()
               throws LifecycleException

  Prepare for the beginning of active use of the public methods of this component. This method should be called after `configure()`, and before any of the public methods of the component are utilized.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if this component detects a fatal error that prevents this component from being used

### stop

    public void stop()
              throws LifecycleException

  Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if this component detects a fatal error that needs to be reported

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Process property change events from our associated Context.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  Parameters:
    `event` - The property change event that has occurred

### run

    public void run()

  The background thread that checks for session timeouts and shutdown.

  Specified by:
    `run` in interface `java.lang.Runnable`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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