Class StandardManager

  • All Implemented Interfaces:
    javax.management.MBeanRegistration, JmxEnabled, 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
    • Field Detail

      • name

        protected static final java.lang.String name
        The descriptive name of this Manager implementation (for logging).
        See Also:
        Constant Field Values
      • pathname

        protected java.lang.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 jakarta.servlet.context.tempdir context attribute.
    • Constructor Detail

      • StandardManager

        public StandardManager()
    • Method Detail

      • getName

        public java.lang.String getName()
        Overrides:
        getName in class ManagerBase
        Returns:
        The descriptive short name of this Manager implementation.
      • getPathname

        public java.lang.String getPathname()
        Returns:
        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
      • load

        public void load()
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
        Description copied from interface: Manager
        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:
        java.lang.ClassNotFoundException - if a serialized class cannot be found during the reload
        java.io.IOException - if an input/output error occurs
      • doLoad

        protected void doLoad()
                       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.
        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
        Description copied from interface: Manager
        Save any currently active sessions in the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.
        Throws:
        java.io.IOException - if an input/output error occurs
      • doUnload

        protected void doUnload()
                         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.
        Throws:
        java.io.IOException - if an input/output error occurs
      • file

        protected java.io.File file()
        Return a File object representing the pathname to our persistence file, if any.
        Returns:
        the file