ReplicatedContext (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.catalina.ha.context, class: ReplicatedContext

# Class ReplicatedContext

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.core.ContainerBase
org.apache.catalina.core.StandardContext
org.apache.catalina.ha.context.ReplicatedContext

All Implemented Interfaces:
  `MBeanRegistration, NotificationBroadcaster, NotificationEmitter, Container, Context, JmxEnabled, Lifecycle, AbstractReplicatedMap.MapOwner, ContextBind`

public class ReplicatedContext extends StandardContext implements AbstractReplicatedMap.MapOwner
Replicated context that supports session replication across cluster nodes.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `ReplicatedContext.MultiEnumeration<T>`
  Enumeration that combines multiple enumerations into one.
  `protected static class`
  `ReplicatedContext.ReplApplContext`
  Application context implementation for replicated contexts.

  ### Nested classes/interfaces inherited from class ContainerBase

  `ContainerBase.ContainerBackgroundProcessor, ContainerBase.ContainerBackgroundProcessorMonitor, ContainerBase.PrivilegedAddChild`

  ### Nested classes/interfaces inherited from interface Lifecycle

  `Lifecycle.SingleUse`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final long`
  `DEFAULT_REPL_TIMEOUT`
  Default replication timeout in milliseconds.

  ### Fields inherited from class StandardContext

  `allowCasualMultipartParsing, context, DEFAULT_NAMING_LISTENER, manager, threadBindingListener`

  ### Fields inherited from class ContainerBase

  `accessLog, backgroundProcessorDelay, backgroundProcessorFuture, children, cluster, listeners, logger, logName, monitorFuture, name, parent, parentClassLoader, pipeline, startChildren, startStopExecutor, support`

  ### Fields inherited from interface Container

  `ADD_CHILD_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_VALVE_EVENT`

  ### Fields inherited from interface Context

  `ADD_WELCOME_FILE_EVENT, CHANGE_SESSION_ID_EVENT, CLEAR_WELCOME_FILES_EVENT, REMOVE_WELCOME_FILE_EVENT, WEBAPP_PROTOCOL`

  ### Fields inherited from interface 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
  Description
  `ReplicatedContext()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ClassLoader[]`
  `getClassLoaders()`
  Return the class loaders to use for serialization.
  `int`
  `getMapSendOptions()`
  Return the options for sending map updates.
  `ServletContext`
  `getServletContext()`
  Returns the ServletContext instance for which this Context acts as a facade.
  `void`
  `objectMadePrimary(Object key, Object value)`
  Called when an object becomes primary on this node.
  `void`
  `setMapSendOptions(int mapSendOptions)`
  Set the options for sending map updates.
  `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()`.

  ### Methods inherited from class StandardContext

  `addApplicationEventListener, addApplicationLifecycleListener, addApplicationListener, addApplicationParameter, addChild, addConstraint, addErrorPage, addFilterDef, addFilterMap, addFilterMapBefore, addLocaleEncodingMappingParameter, addMessageDestination, addMimeMapping, addNotificationListener, addParameter, addPostConstructMethod, addPreDestroyMethod, addRoleMapping, addSecurityRole, addServletContainerInitializer, addServletMappingDecoded, addServletSecurity, addWatchedResource, addWelcomeFile, addWrapperLifecycle, addWrapperListener, adjustURLPattern, backgroundProcess, bind, bindThread, createInstanceManager, createWrapper, decrementInProgressAsyncCount, destroyInternal, dynamicServletCreated, filterStart, filterStop, findApplicationListeners, findApplicationParameters, findConstraints, findErrorPage, findErrorPage, findErrorPages, findFilterConfig, findFilterDef, findFilterDefs, findFilterMaps, findMessageDestination, findMessageDestinations, findMimeMapping, findMimeMappings, findParameter, findParameters, findPostConstructMethod, findPostConstructMethods, findPreDestroyMethod, findPreDestroyMethods, findRoleMapping, findSecurityRole, findSecurityRoles, findServletMapping, findServletMappings, findWatchedResources, findWelcomeFile, findWelcomeFiles, findWrapperLifecycles, findWrapperListeners, fireRequestDestroyEvent, fireRequestInitEvent, getAddWebinfClassesResources, getAllowCasualMultipartParsing, getAllowMultipleLeadingForwardSlashInPath, getAltDDName, getAlwaysAccessSession, getAntiResourceLocking, getApplicationEventListeners, getApplicationLifecycleListeners, getAuthenticator, getBaseName, getCharset, getCharsetMapper, getCharsetMapperClass, getClearReferencesHttpClientKeepAliveThread, getClearReferencesObjectStreamClassCaches, getClearReferencesRmiTargets, getClearReferencesStopThreads, getClearReferencesStopTimerThreads, getClearReferencesThreadLocals, getComputedFailCtxIfServletStartFails, getConfigFile, getConfigured, getContainerSciFilter, getContextGetResourceRequiresSlash, getCookieProcessor, getCookies, getCopyXML, getCreateUploadTargets, getCrossContext, getDefaultContextXml, getDefaultWebXml, getDelegate, getDenyUncoveredHttpMethods, getDispatchersUseEncodedPaths, getDispatcherWrapsSameObject, getDisplayName, getDistributable, getDocBase, getEffectiveMajorVersion, getEffectiveMinorVersion, getEncodedPath, getEncodedReverseSolidusHandling, getEncodedReverseSolidusHandlingEnum, getEncodedSolidusHandling, getEncodedSolidusHandlingEnum, getErrorCount, getFailCtxIfServletStartFails, getFireRequestListenersOnForwards, getIgnoreAnnotations, getInProgressAsyncCount, getInstanceManager, getJ2EEApplication, getJ2EEServer, getJarScanner, getJndiExceptionOnFailedWrite, getJspConfigDescriptor, getLoader, getLogEffectiveWebXml, getLoginConfig, getManager, getMapperContextRootRedirectEnabled, getMapperDirectoryRedirectEnabled, getMaxTime, getMinTime, getNamingContextListener, getNamingResources, getNamingToken, getNotFoundClassResourceCacheSize, getNotificationInfo, getObjectNameKeyProperties, getOriginalDocBase, getOverride, getParallelAnnotationScanning, getParentClassLoader, getPath, getPaused, getPreemptiveAuthentication, getPrivileged, getProcessingTime, getPublicId, getRealPath, getReloadable, getRenewThreadsWhenStoppingContext, getRequestCharacterEncoding, getRequestCount, getResourceOnlyServlets, getResources, getResponseCharacterEncoding, getSendRedirectBody, getServer, getSessionCookieDomain, getSessionCookieName, getSessionCookiePath, getSessionCookiePathUsesTrailingSlash, getSessionTimeout, getSkipMemoryLeakChecksOnJvmShutdown, getStartTime, getStartupTime, getSuspendWrappedResponseAfterForward, getSwallowAbortedUploads, getSwallowOutput, getThreadBindingListener, getTldScanTime, getTldValidation, getUnloadDelay, getUnpackWAR, getUseBloomFilterForArchives, getUseHttpOnly, getUsePartitioned, getUseRelativeRedirects, getValidateClientProvidedNewSessionId, getWebappVersion, getWelcomeFiles, getWorkDir, getWorkPath, getWrapperClass, getXmlBlockExternal, getXmlNamespaceAware, getXmlValidation, incrementInProgressAsyncCount, initInternal, isResourceOnlyServlet, isServlet22, isUseNaming, listenerStart, listenerStop, loadOnStartup, postWorkDirectory, reload, removeApplicationListener, removeApplicationParameter, removeChild, removeConstraint, removeErrorPage, removeFilterDef, removeFilterMap, removeMessageDestination, removeMimeMapping, removeNotificationListener, removeNotificationListener, removeParameter, removePostConstructMethod, removePreDestroyMethod, removeRoleMapping, removeSecurityRole, removeServletMapping, removeWatchedResource, removeWelcomeFile, removeWrapperLifecycle, removeWrapperListener, resourcesStart, resourcesStop, setAddWebinfClassesResources, setAllowCasualMultipartParsing, setAllowMultipleLeadingForwardSlashInPath, setAltDDName, setAlwaysAccessSession, setAntiResourceLocking, setApplicationEventListeners, setApplicationLifecycleListeners, setCharsetMapper, setCharsetMapperClass, setClearReferencesHttpClientKeepAliveThread, setClearReferencesObjectStreamClassCaches, setClearReferencesRmiTargets, setClearReferencesStopThreads, setClearReferencesStopTimerThreads, setClearReferencesThreadLocals, setConfigFile, setConfigured, setContainerSciFilter, setContextGetResourceRequiresSlash, setCookieProcessor, setCookies, setCopyXML, setCreateUploadTargets, setCrossContext, setDefaultContextXml, setDefaultWebXml, setDelegate, setDenyUncoveredHttpMethods, setDispatchersUseEncodedPaths, setDispatcherWrapsSameObject, setDisplayName, setDistributable, setDocBase, setEffectiveMajorVersion, setEffectiveMinorVersion, setEncodedReverseSolidusHandling, setEncodedSolidusHandling, setFailCtxIfServletStartFails, setFireRequestListenersOnForwards, setIgnoreAnnotations, setInstanceManager, setJ2EEApplication, setJ2EEServer, setJarScanner, setJndiExceptionOnFailedWrite, setJspConfigDescriptor, setLoader, setLogEffectiveWebXml, setLoginConfig, setManager, setMapperContextRootRedirectEnabled, setMapperDirectoryRedirectEnabled, setNamingContextListener, setNamingResources, setNotFoundClassResourceCacheSize, setOriginalDocBase, setOverride, setParallelAnnotationScanning, setPath, setPreemptiveAuthentication, setPrivileged, setPublicId, setReloadable, setRenewThreadsWhenStoppingContext, setReplaceWelcomeFiles, setRequestCharacterEncoding, setResourceOnlyServlets, setResources, setResponseCharacterEncoding, setSendRedirectBody, setServer, setSessionCookieDomain, setSessionCookieName, setSessionCookiePath, setSessionCookiePathUsesTrailingSlash, setSessionTimeout, setSkipMemoryLeakChecksOnJvmShutdown, setStartupTime, setSuspendWrappedResponseAfterForward, setSwallowAbortedUploads, setSwallowOutput, setThreadBindingListener, setTldScanTime, setTldValidation, setUnloadDelay, setUnpackWAR, setUseBloomFilterForArchives, setUseHttpOnly, setUseNaming, setUsePartitioned, setUseRelativeRedirects, setValidateClientProvidedNewSessionId, setWebappVersion, setWorkDir, setWrapperClass, setXmlBlockExternal, setXmlNamespaceAware, setXmlValidation, unbind, unbindThread, wasCreatedDynamicServlet`

  ### Methods inherited from class ContainerBase

  `addContainerListener, addPropertyChangeListener, addValve, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCatalinaBase, getCatalinaHome, getChildren, getCluster, getClusterInternal, getDomainInternal, getLogger, getLogName, getMBeanKeyProperties, getName, getParent, getPipeline, getRealm, getRealmInternal, getStartChildren, getStartStopThreads, logAccess, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setName, setParent, setParentClassLoader, setRealm, setStartChildren, setStartStopThreads, threadStart, threadStop, toString`

  ### Methods inherited from class LifecycleMBeanBase

  `getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister`

  ### Methods inherited from class LifecycleBase

  `addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface Container

  `addContainerListener, addPropertyChangeListener, findChild, findChildren, findContainerListeners, fireContainerEvent, getAccessLog, getBackgroundProcessorDelay, getCatalinaBase, getCatalinaHome, getCluster, getDomain, getLogger, getLogName, getMBeanKeyProperties, getName, getObjectName, getParent, getPipeline, getRealm, getStartStopThreads, logAccess, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCluster, setName, setParent, setParentClassLoader, setRealm, setStartStopThreads`

  ### Methods inherited from interface Context

  `addServletMappingDecoded, findConfigFileResource, isParallelAnnotationScanning`

  ### Methods inherited from interface Lifecycle

  `addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop`

- ## Field Details

  - ### DEFAULT_REPL_TIMEOUT

    protected static final long DEFAULT_REPL_TIMEOUT
    Default replication timeout in milliseconds.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ReplicatedContext

    public ReplicatedContext()
    Default constructor.

- ## Method Details

  - ### startInternal

    protected void startInternal() throws LifecycleException
    Start this component and implement the requirements of `LifecycleBase.startInternal()`.
    Overrides:
      `startInternal` in class `StandardContext`
    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 `StandardContext`
    Throws:
      `LifecycleException` - if this component detects a fatal error that prevents this component from being used

  - ### setMapSendOptions

    public void setMapSendOptions(int mapSendOptions)
    Set the options for sending map updates.
    Parameters:
      `mapSendOptions` - the send options

  - ### getMapSendOptions

    public int getMapSendOptions()
    Return the options for sending map updates.
    Returns:
      the send options

  - ### getClassLoaders

    public ClassLoader[] getClassLoaders()
    Return the class loaders to use for serialization.
    Returns:
      the class loaders

  - ### getServletContext

    public ServletContext getServletContext()
    Description copied from interface: `Context`
    Returns the ServletContext instance for which this Context acts as a facade.
    Specified by:
      `getServletContext` in interface `Context`
    Overrides:
      `getServletContext` in class `StandardContext`
    Returns:
      the ServletContext instance, or `null` if not yet initialized

  - ### objectMadePrimary

    public void objectMadePrimary(Object key, Object value)
    Description copied from interface: `AbstractReplicatedMap.MapOwner`
    Called when an object becomes primary on this node.
    Specified by:
      `objectMadePrimary` in interface `AbstractReplicatedMap.MapOwner`
    Parameters:
      `key` - The key of the object
      `value` - The value of the object