org.apache.catalina.session

## Class StandardManager

- java.lang.Object
- - org.apache.catalina.util.LifecycleBase
  - - org.apache.catalina.util.LifecycleMBeanBase
    - - org.apache.catalina.session.ManagerBase
      - - org.apache.catalina.session.StandardManager

All Implemented Interfaces:
  PropertyChangeListener, EventListener, MBeanRegistration, Lifecycle, Manager

    public class StandardManager
    extends ManagerBase

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.

Author:
  Craig R. McClanahan, Jean-Francois Arcand

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.catalina.session.ManagerBase

`ManagerBase.SessionTiming`

### Field Summary

Fields
`protected static String` `info` The descriptive information about this implementation.
`protected static String` `name` The descriptive name of this Manager implementation (for logging).
`protected String` `pathname` Path name of the disk file in which active sessions are saved when we stop, and from which these sessions are loaded when we start.

### Fields inherited from class org.apache.catalina.session.ManagerBase

`container, distributable, duplicates, expiredSessions, maxActive, maxActiveSessions, maxInactiveInterval, processExpiresFrequency, processingTime, rejectedSessions, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdGenerator, sessionIdLength, sessionMaxAliveTime, sessions, sm, support, TIMING_STATS_CACHE_SIZE`

### Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase

`mserver`

### Fields inherited from interface org.apache.catalina.Lifecycle

`AFTER_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 Summary

Constructors
Constructor and Description
`StandardManager()`

### Method Summary

Methods
`protected void` `doLoad()` Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any.
`protected void` `doUnload()` Save any currently active sessions in the appropriate persistence mechanism, if any.
`protected File` `file()` Return a File object representing the pathname to our persistence file, if any.
`String` `getInfo()` Return descriptive information about this Manager implementation and the corresponding version number, in the format `<description>/<version>`.
`String` `getName()` Return the descriptive short name of this Manager implementation.
`String` `getPathname()` Return the session persistence pathname, if any.
`void` `load()` Load any currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any.
`void` `setPathname(String pathname)` Set the session persistence pathname to the specified value.
`protected void` `startInternal()` Start this component and implement the requirements of `LifecycleBase.startInternal()`.
`protected void` `stopInternal()` Stop this component and implement the requirements of `LifecycleBase.stopInternal()`.
`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, backgroundProcess, changeSessionId, createEmptySession, createSession, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getClassName, getContainer, getCreationTime, getCreationTimestamp, getDistributable, getDomainInternal, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getMaxInactiveInterval, getNewSession, getObjectNameKeyProperties, getProcessExpiresFrequency, getProcessingTime, getRejectedSessions, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdLength, getSessionMaxAliveTime, getThisAccessedTime, getThisAccessedTimestamp, initInternal, listSessionIds, processExpires, propertyChange, remove, remove, removePropertyChangeListener, setContainer, setDistributable, setDuplicates, setExpiredSessions, setMaxActive, setMaxActiveSessions, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, toString, updateSessionMaxAliveTime`

### Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase

`destroyInternal, 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, stop`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### info

    protected static final String info

The descriptive information about this implementation.

See Also:
  Constant Field Values

#### name

    protected static final String name

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

See Also:
  Constant Field Values

#### pathname

    protected String pathname

Path name of the disk file in which active sessions are saved when we stop, and from which these sessions are loaded when we start. A `null` value indicates that no persistence is desired. If this pathname is relative, it will be resolved against the temporary working directory provided by our context, available via the `javax.servlet.context.tempdir` context attribute.

### Constructor Detail

#### StandardManager

    public StandardManager()

### Method Detail

#### getInfo

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

#### getName

    public String getName()

Return the descriptive short name of this Manager implementation.

Overrides:
  `getName` in class `ManagerBase`

#### getPathname

    public String getPathname()

Return the session persistence pathname, if any.

#### setPathname

    public void setPathname(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

#### load

    public void load()
              throws ClassNotFoundException,
                     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.

Throws:
  `ClassNotFoundException` - if a serialized class cannot be found during the reload
  `IOException` - if an input/output error occurs

#### doLoad

    protected void doLoad()
                   throws ClassNotFoundException,
                          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.

Throws:
  `ClassNotFoundException` - if a serialized class cannot be found during the reload
  `IOException` - if an input/output error occurs

#### unload

    public void unload()
                throws IOException

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

Throws:
  `IOException` - if an input/output error occurs

#### doUnload

    protected void doUnload()
                     throws IOException

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

Throws:
  `IOException` - if an input/output error occurs

#### startInternal

    protected void startInternal()
                          throws LifecycleException

Start this component and implement the requirements of `LifecycleBase.startInternal()`.

Overrides:
  `startInternal` in class `ManagerBase`
Throws:
  `LifecycleException` - if this component detects a fatal error that prevents this component from being used

#### stopInternal

    protected void stopInternal()
                         throws LifecycleException

Stop this component and implement the requirements of `LifecycleBase.stopInternal()`.

Overrides:
  `stopInternal` in class `ManagerBase`
Throws:
  `LifecycleException` - if this component detects a fatal error that prevents this component from being used

#### file

    protected File file()

Return a File object representing the pathname to our persistence file, if any.