DeltaSessionManager (Apache Geode 1.6.0)
Date: 2018-04-23

org.apache.geode.modules.session.catalina

## Class DeltaSessionManager

- java.lang.Object
- - org.apache.catalina.session.ManagerBase
  - - org.apache.geode.modules.session.catalina.DeltaSessionManager

- All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener, javax.management.MBeanRegistration, org.apache.catalina.Lifecycle, org.apache.catalina.Manager, SessionManager
  Direct Known Subclasses:
    Tomcat6DeltaSessionManager, Tomcat7DeltaSessionManager, Tomcat8DeltaSessionManager

      public abstract class DeltaSessionManager
      extends org.apache.catalina.session.ManagerBase
      implements org.apache.catalina.Lifecycle, java.beans.PropertyChangeListener, SessionManager

- - ### Nested Class Summary

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

      `org.apache.catalina.session.ManagerBase.SessionTiming`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.catalina.Valve` | `commitSessionValve`
    `protected static boolean` | `DEFAULT_ENABLE_COMMIT_VALVE`
    `protected static boolean` | `DEFAULT_ENABLE_COMMIT_VALVE_FAILFAST`
    `protected static boolean` | `DEFAULT_ENABLE_DEBUG_LISTENER`
    `protected static boolean` | `DEFAULT_ENABLE_GATEWAY_DELTA_REPLICATION`
    `protected static boolean` | `DEFAULT_ENABLE_GATEWAY_REPLICATION`
    `protected static boolean` | `DEFAULT_PREFER_DESERIALIZED_FORM`
    `protected static java.lang.String` | `DEFAULT_REGION_NAME`
    `protected boolean` | `enableCommitValve`
    `protected boolean` | `enableCommitValveFailfast`
    `protected boolean` | `enableDebugListener`
    `protected boolean` | `enableGatewayDeltaReplication`
    `protected boolean` | `enableGatewayReplication`
    `protected java.lang.Boolean` | `enableLocalCache`
    `protected org.apache.catalina.Valve` | `jvmRouteBinderValve`
    `protected org.apache.juli.logging.Log` | `LOGGER`
    `protected int` | `maxActiveSessions` The maximum number of active Sessions allowed, or -1 for no limit.
    `protected java.lang.String` | `name` The name of this `Manager`
    `protected boolean` | `preferDeserializedForm`
    `protected java.lang.String` | `regionAttributesId`
    `protected java.lang.String` | `regionName`
    `protected SessionCache` | `sessionCache`
    `protected java.util.concurrent.atomic.AtomicBoolean` | `started` Has this `Manager` been started?

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

      `algorithm, container, DEFAULT_ALGORITHM, devRandomSource, digest, distributable, domain, duplicates, entropy, expiredSessions, initialized, log, maxActive, maxInactiveInterval, mserver, oname, processExpiresFrequency, processingTime, random, randomClass, randomIS, sessionAverageAliveTime, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdLength, sessionMaxAliveTime, sessions, sm, support, TIMING_STATS_CACHE_SIZE`

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

      `AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeltaSessionManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(org.apache.catalina.Session session)`
    `protected void` | `addSessionToTouch(java.lang.String sessionId)`
    `protected void` | `cancelTimer()`
    `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.
    `org.apache.catalina.Session` | `findSession(java.lang.String id)`
    `int` | `getActiveSessions()` Returns the number of active sessions
    `protected java.lang.String` | `getContextName()`
    `boolean` | `getEnableDebugListener()`
    `boolean` | `getEnableGatewayDeltaReplication()`
    `boolean` | `getEnableGatewayReplication()`
    `boolean` | `getEnableLocalCache()`
    `org.apache.juli.logging.Log` | `getLogger()`
    `int` | `getMaxActiveSessions()`
    `protected org.apache.catalina.session.StandardSession` | `getNewSession()`
    `protected org.apache.catalina.Pipeline` | `getPipeline()`
    `boolean` | `getPreferDeserializedForm()`
    `java.lang.String` | `getRegionAttributesId()`
    `java.lang.String` | `getRegionName()`
    `int` | `getRejectedSessions()`
    `SessionCache` | `getSessionCache()`
    `protected java.util.Set<java.lang.String>` | `getSessionsToTouch()`
    `org.apache.geode.modules.session.catalina.internal.DeltaSessionStatistics` | `getStatistics()`
    `java.lang.String` | `getStatisticsName()`
    `org.apache.catalina.Context` | `getTheContext()`
    `protected void` | `initializeSessionCache()`
    `boolean` | `isBackingCacheAvailable()`
    `boolean` | `isClientServer()`
    `boolean` | `isCommitValveEnabled()`
    `boolean` | `isCommitValveFailfastEnabled()`
    `boolean` | `isPeerToPeer()`
    `java.lang.String` | `listSessionIds()` For debugging: return a list of all session ids currently active
    `void` | `load()`
    `void` | `propertyChange(java.beans.PropertyChangeEvent event)` Process property change events from our associated Context.
    `protected void` | `registerCommitSessionValve()`
    `protected void` | `registerJvmRouteBinderValve()`
    `void` | `remove(org.apache.catalina.Session session)`
    `void` | `remove(org.apache.catalina.Session session, boolean update)`
    `protected boolean` | `removeTouchedSession(java.lang.String sessionId)`
    `protected void` | `scheduleTimerTasks()`
    `void` | `setContainer(org.apache.catalina.Container container)` This method was taken from StandardManager to set the default maxInactiveInterval based on the container (to 30 minutes).
    `void` | `setEnableCommitValve(boolean enable)`
    `void` | `setEnableCommitValveFailfast(boolean enable)`
    `void` | `setEnableDebugListener(boolean enableDebugListener)`
    `void` | `setEnableGatewayDeltaReplication(boolean enableGatewayDeltaReplication)`
    `void` | `setEnableGatewayReplication(boolean enableGatewayReplication)`
    `void` | `setEnableLocalCache(boolean enableLocalCache)`
    `void` | `setMaxActiveSessions(int maxActiveSessions)`
    `void` | `setMaxInactiveInterval(int interval)`
    `void` | `setPreferDeserializedForm(boolean enable)`
    `void` | `setRegionAttributesId(java.lang.String regionType)`
    `void` | `setRegionName(java.lang.String regionName)`
    `void` | `setRejectedSessions(int rejectedSessions)`
    `java.lang.String` | `toString()`
    `void` | `unload()`
    `protected void` | `unregisterCommitSessionValve()`
    `protected void` | `unregisterJvmRouteBinderValve()`

    - ### Methods inherited from class org.apache.catalina.session.ManagerBase

      `addPropertyChangeListener, backgroundProcess, changeSessionId, createEmptySession, createSession, createSession, destroy, expireSession, findSessions, generateSessionId, getAlgorithm, getClassName, getContainer, getCreationTime, getCreationTimestamp, getDigest, getDistributable, getDomain, getDuplicates, getEngine, getEntropy, getExpiredSessions, getInfo, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxInactiveInterval, getName, getObjectName, getProcessExpiresFrequency, getProcessingTime, getRandom, getRandomBytes, getRandomClass, getRandomFile, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdLength, getSessionMaxAliveTime, init, postDeregister, postRegister, preDeregister, preRegister, processExpires, removePropertyChangeListener, setAlgorithm, setDistributable, setDuplicates, setEntropy, setExpiredSessions, setMaxActive, setProcessExpiresFrequency, setProcessingTime, setRandomClass, setRandomFile, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime`

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

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

    - ### Methods inherited from interface org.apache.catalina.Lifecycle

      `addLifecycleListener, findLifecycleListeners, removeLifecycleListener, start, stop`

    - ### Methods inherited from interface org.apache.geode.modules.session.catalina.SessionManager

      `getMaxInactiveInterval`

- - ### Field Detail

    - #### maxActiveSessions

          protected int maxActiveSessions

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

    - #### started

          protected java.util.concurrent.atomic.AtomicBoolean started

      Has this `Manager` been started?

    - #### name

          protected java.lang.String name

      The name of this `Manager`

    - #### jvmRouteBinderValve

          protected org.apache.catalina.Valve jvmRouteBinderValve

    - #### commitSessionValve

          protected org.apache.catalina.Valve commitSessionValve

    - #### sessionCache

          protected SessionCache sessionCache

    - #### DEFAULT_REGION_NAME

          protected static final java.lang.String DEFAULT_REGION_NAME

      See Also:
        Constant Field Values

    - #### DEFAULT_ENABLE_GATEWAY_DELTA_REPLICATION

          protected static final boolean DEFAULT_ENABLE_GATEWAY_DELTA_REPLICATION

      See Also:
        Constant Field Values

    - #### DEFAULT_ENABLE_GATEWAY_REPLICATION

          protected static final boolean DEFAULT_ENABLE_GATEWAY_REPLICATION

      See Also:
        Constant Field Values

    - #### DEFAULT_ENABLE_DEBUG_LISTENER

          protected static final boolean DEFAULT_ENABLE_DEBUG_LISTENER

      See Also:
        Constant Field Values

    - #### DEFAULT_ENABLE_COMMIT_VALVE

          protected static final boolean DEFAULT_ENABLE_COMMIT_VALVE

      See Also:
        Constant Field Values

    - #### DEFAULT_ENABLE_COMMIT_VALVE_FAILFAST

          protected static final boolean DEFAULT_ENABLE_COMMIT_VALVE_FAILFAST

      See Also:
        Constant Field Values

    - #### DEFAULT_PREFER_DESERIALIZED_FORM

          protected static final boolean DEFAULT_PREFER_DESERIALIZED_FORM

      See Also:
        Constant Field Values

    - #### LOGGER

          protected org.apache.juli.logging.Log LOGGER

    - #### regionName

          protected java.lang.String regionName

    - #### regionAttributesId

          protected java.lang.String regionAttributesId

    - #### enableLocalCache

          protected java.lang.Boolean enableLocalCache

    - #### enableCommitValve

          protected boolean enableCommitValve

    - #### enableCommitValveFailfast

          protected boolean enableCommitValveFailfast

    - #### enableGatewayDeltaReplication

          protected boolean enableGatewayDeltaReplication

    - #### enableGatewayReplication

          protected boolean enableGatewayReplication

    - #### enableDebugListener

          protected boolean enableDebugListener

    - #### preferDeserializedForm

          protected boolean preferDeserializedForm

  - ### Constructor Detail

    - #### DeltaSessionManager

          public DeltaSessionManager()

  - ### Method Detail

    - #### getRegionName

          public java.lang.String getRegionName()

      Specified by:
        `getRegionName` in interface `SessionManager`

    - #### setRegionName

          public void setRegionName(java.lang.String regionName)

    - #### setMaxInactiveInterval

          public void setMaxInactiveInterval(int interval)

      Specified by:
        `setMaxInactiveInterval` in interface `org.apache.catalina.Manager`
      Overrides:
        `setMaxInactiveInterval` in class `org.apache.catalina.session.ManagerBase`

    - #### getRegionAttributesId

          public java.lang.String getRegionAttributesId()

      Specified by:
        `getRegionAttributesId` in interface `SessionManager`

    - #### setRegionAttributesId

          public void setRegionAttributesId(java.lang.String regionType)

    - #### getEnableLocalCache

          public boolean getEnableLocalCache()

      Specified by:
        `getEnableLocalCache` in interface `SessionManager`

    - #### setEnableLocalCache

          public void setEnableLocalCache(boolean enableLocalCache)

    - #### getMaxActiveSessions

          public int getMaxActiveSessions()

    - #### setMaxActiveSessions

          public void setMaxActiveSessions(int maxActiveSessions)

    - #### getEnableGatewayDeltaReplication

          public boolean getEnableGatewayDeltaReplication()

      Specified by:
        `getEnableGatewayDeltaReplication` in interface `SessionManager`

    - #### setEnableGatewayDeltaReplication

          public void setEnableGatewayDeltaReplication(boolean enableGatewayDeltaReplication)

    - #### getEnableGatewayReplication

          public boolean getEnableGatewayReplication()

      Specified by:
        `getEnableGatewayReplication` in interface `SessionManager`

    - #### setEnableGatewayReplication

          public void setEnableGatewayReplication(boolean enableGatewayReplication)

    - #### getEnableDebugListener

          public boolean getEnableDebugListener()

      Specified by:
        `getEnableDebugListener` in interface `SessionManager`

    - #### setEnableDebugListener

          public void setEnableDebugListener(boolean enableDebugListener)

    - #### isCommitValveEnabled

          public boolean isCommitValveEnabled()

      Specified by:
        `isCommitValveEnabled` in interface `SessionManager`

    - #### setEnableCommitValve

          public void setEnableCommitValve(boolean enable)

    - #### isCommitValveFailfastEnabled

          public boolean isCommitValveFailfastEnabled()

      Specified by:
        `isCommitValveFailfastEnabled` in interface `SessionManager`

    - #### setEnableCommitValveFailfast

          public void setEnableCommitValveFailfast(boolean enable)

    - #### isBackingCacheAvailable

          public boolean isBackingCacheAvailable()

      Specified by:
        `isBackingCacheAvailable` in interface `SessionManager`

    - #### setPreferDeserializedForm

          public void setPreferDeserializedForm(boolean enable)

    - #### getPreferDeserializedForm

          public boolean getPreferDeserializedForm()

      Specified by:
        `getPreferDeserializedForm` in interface `SessionManager`

    - #### getStatisticsName

          public java.lang.String getStatisticsName()

      Specified by:
        `getStatisticsName` in interface `SessionManager`

    - #### getLogger

          public org.apache.juli.logging.Log getLogger()

      Specified by:
        `getLogger` in interface `SessionManager`

    - #### getSessionCache

          public SessionCache getSessionCache()

    - #### getStatistics

          public org.apache.geode.modules.session.catalina.internal.DeltaSessionStatistics getStatistics()

    - #### isPeerToPeer

          public boolean isPeerToPeer()

    - #### isClientServer

          public boolean isClientServer()

    - #### setContainer

          public void setContainer(org.apache.catalina.Container container)

      This method was taken from StandardManager to set the default maxInactiveInterval based on the container (to 30 minutes).

      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 `org.apache.catalina.Manager`
      Overrides:
        `setContainer` in class `org.apache.catalina.session.ManagerBase`
      Parameters:
        `container` - The associated Container

    - #### findSession

          public org.apache.catalina.Session findSession(java.lang.String id)
                                                  throws java.io.IOException

      Specified by:
        `findSession` in interface `org.apache.catalina.Manager`
      Overrides:
        `findSession` in class `org.apache.catalina.session.ManagerBase`
      Throws:
        `java.io.IOException`

    - #### initializeSessionCache

          protected void initializeSessionCache()

    - #### getNewSession

          protected org.apache.catalina.session.StandardSession getNewSession()

      Overrides:
        `getNewSession` in class `org.apache.catalina.session.ManagerBase`

    - #### remove

          public void remove(org.apache.catalina.Session session)

      Specified by:
        `remove` in interface `org.apache.catalina.Manager`
      Overrides:
        `remove` in class `org.apache.catalina.session.ManagerBase`

    - #### remove

          public void remove(org.apache.catalina.Session session,
                             boolean update)

    - #### add

          public void add(org.apache.catalina.Session session)

      Specified by:
        `add` in interface `org.apache.catalina.Manager`
      Overrides:
        `add` in class `org.apache.catalina.session.ManagerBase`

    - #### getRejectedSessions

          public int getRejectedSessions()

      Specified by:
        `getRejectedSessions` in interface `org.apache.catalina.Manager`

    - #### setRejectedSessions

          public void setRejectedSessions(int rejectedSessions)

      Specified by:
        `setRejectedSessions` in interface `org.apache.catalina.Manager`

    - #### getActiveSessions

          public int getActiveSessions()

      Returns the number of active sessions
      Specified by:
        `getActiveSessions` in interface `org.apache.catalina.Manager`
      Overrides:
        `getActiveSessions` in class `org.apache.catalina.session.ManagerBase`
      Returns:
        number of sessions active

    - #### listSessionIds

          public java.lang.String listSessionIds()

      For debugging: return a list of all session ids currently active
      Overrides:
        `listSessionIds` in class `org.apache.catalina.session.ManagerBase`

    - #### addSessionToTouch

          protected void addSessionToTouch(java.lang.String sessionId)

    - #### getSessionsToTouch

          protected java.util.Set<java.lang.String> getSessionsToTouch()

    - #### removeTouchedSession

          protected boolean removeTouchedSession(java.lang.String sessionId)

    - #### scheduleTimerTasks

          protected void scheduleTimerTasks()

    - #### cancelTimer

          protected void cancelTimer()

    - #### load

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

      Specified by:
        `load` in interface `org.apache.catalina.Manager`
      Throws:
        `java.lang.ClassNotFoundException`
        `java.io.IOException`

    - #### unload

          public void unload()
                      throws java.io.IOException

      Specified by:
        `unload` in interface `org.apache.catalina.Manager`
      Throws:
        `java.io.IOException`

    - #### registerJvmRouteBinderValve

          protected void registerJvmRouteBinderValve()

    - #### getPipeline

          protected org.apache.catalina.Pipeline getPipeline()

    - #### unregisterJvmRouteBinderValve

          protected void unregisterJvmRouteBinderValve()

    - #### registerCommitSessionValve

          protected void registerCommitSessionValve()

    - #### unregisterCommitSessionValve

          protected void unregisterCommitSessionValve()

    - #### propertyChange

          public void propertyChange(java.beans.PropertyChangeEvent event)

      Process property change events from our associated Context.

      Part of this method implementation was taken from StandardManager. The sessionTimeout can be changed in the web.xml which is processed after the context.xml. The context (and the default session timeout) would already have been set in this Manager. This is the way to get the new session timeout value specified in the web.xml.

      The precedence order for setting the session timeout value is:

      1. the max inactive interval is set based on the Manager defined in the context.xml
      2. the max inactive interval is then overwritten by the value of the Context's session timeout when setContainer is called
      3. the max inactive interval is then overwritten by the value of the session-timeout specified in the web.xml (if any)
      Specified by:
        `propertyChange` in interface `java.beans.PropertyChangeListener`
      Parameters:
        `event` - The property change event that has occurred

    - #### 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

    - #### 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

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getContextName

          protected java.lang.String getContextName()

    - #### getTheContext

          public org.apache.catalina.Context getTheContext()