# Class ClusterManagerBase

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.session.ManagerBase
org.apache.catalina.ha.session.ClusterManagerBase

All Implemented Interfaces:
  `MBeanRegistration, ClusterManager, JmxEnabled, Lifecycle, Manager`

Direct Known Subclasses:
  `BackupManager, DeltaManager`

public abstract class ClusterManagerBase extends ManagerBase implements ClusterManager
Base class for cluster session managers. Provides common functionality for session replication and clustering.

## Nested Class Summary

### Nested classes/interfaces inherited from class ManagerBase

`ManagerBase.SessionTiming`

### Nested classes/interfaces inherited from interface Lifecycle

`Lifecycle.SingleUse`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected CatalinaCluster`
`cluster`
A reference to the cluster
`protected static final StringManager`
`sm`
String manager for this class.

### Fields inherited from class ManagerBase

`duplicates, expiredSessions, maxActive, maxActiveSessions, processExpiresFrequency, processingTime, rejectedSessions, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdGenerator, sessionIdGeneratorClass, sessionMaxAliveTime, sessions, support, TIMING_STATS_CACHE_SIZE`

### 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
`ClusterManagerBase()`
Default constructor for ClusterManagerBase.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`clone(ClusterManagerBase copy)`
Clone the configuration from this manager to the specified copy.
`ClassLoader[]`
`getClassLoaders()`
Returns the class loaders for this manager's context.
`static ClassLoader[]`
`getClassLoaders(Context context)`
Returns the class loaders for the specified context.
`CatalinaCluster`
`getCluster()`
Returns the cluster associated with this manager.
`protected SynchronizedStack<DeltaRequest>`
`getDeltaRequestPool()`
Returns the pool of DeltaRequest objects.
`ReplicationStream`
`getReplicationStream(byte[] data)`
Open stream and use correct ClassLoader (Container), switching thread context class loader.
`ReplicationStream`
`getReplicationStream(byte[] data, int offset, int length)`
Open stream and use correct ClassLoader (Container), switching thread context class loader.
`boolean`
`isNotifyListenersOnReplication()`
Returns whether listeners are notified on replication.
`boolean`
`isRecordAllActions()`
Returns whether all session attribute actions should be recorded.
`void`
`load()`
`Manager` implementations that also implement `ClusterManager` do not support local session persistence.
`protected void`
`registerSessionAtReplicationValve(DeltaSession session)`
Register cross context session at replication valve thread local
`void`
`setCluster(CatalinaCluster cluster)`
Set the cluster associated with this manager.
`void`
`setNotifyListenersOnReplication(boolean notifyListenersOnReplication)`
Sets whether listeners should be notified on replication.
`void`
`setRecordAllActions(boolean recordAllActions)`
Sets whether all session attribute actions should be recorded.
`protected void`
`startInternal()`
Subclasses must ensure that the state is changed to `LifecycleState.STARTING` during the execution of this method.
`protected void`
`stopInternal()`
Subclasses must ensure that the state is changed to `LifecycleState.STOPPING` during the execution of this method.
`void`
`unload()`
`Manager` implementations that also implement `ClusterManager` do not support local session persistence.

### Methods inherited from class ManagerBase

`add, addPropertyChangeListener, backgroundProcess, changeSessionId, changeSessionId, createEmptySession, createSession, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getClassName, getContext, getCreationTime, getCreationTimestamp, getDomainInternal, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getName, getNewSession, getNotifyAttributeListenerOnUnchangedValue, getNotifyBindingListenerOnUnchangedValue, getObjectNameKeyProperties, getPersistAuthentication, getProcessExpiresFrequency, getProcessingTime, getRejectedSessions, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, getSession, getSessionActivityCheck, getSessionAttribute, getSessionAttributeNameFilter, getSessionAttributeNamePattern, getSessionAttributeValueClassNameFilter, getSessionAttributeValueClassNamePattern, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionLastAccessAtStart, getSessionMaxAliveTime, getThisAccessedTime, getThisAccessedTimestamp, getWarnOnSessionAttributeFilterFailure, initInternal, listSessionIds, processExpires, remove, remove, removePropertyChangeListener, rotateSessionId, setContext, setDuplicates, setExpiredSessions, setMaxActive, setMaxActiveSessions, setNotifyAttributeListenerOnUnchangedValue, setNotifyBindingListenerOnUnchangedValue, setPersistAuthentication, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionActivityCheck, setSessionAttributeNameFilter, setSessionAttributeValueClassNameFilter, setSessionCounter, setSessionIdGenerator, setSessionLastAccessAtStart, setSessionMaxAliveTime, setWarnOnSessionAttributeFilterFailure, toString, updateSessionMaxAliveTime, willAttributeDistribute`

### Methods inherited from class LifecycleMBeanBase

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

`cloneFromTemplate, getInvalidatedSessions, getName, messageDataReceived, requestCompleted, setName`

### Methods inherited from interface Manager

`add, addPropertyChangeListener, backgroundProcess, changeSessionId, createEmptySession, createSession, findSession, findSessions, getActiveSessions, getContext, getExpiredSessions, getMaxActive, getNotifyAttributeListenerOnUnchangedValue, getNotifyBindingListenerOnUnchangedValue, getRejectedSessions, getSessionActivityCheck, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionLastAccessAtStart, getSessionMaxAliveTime, remove, remove, removePropertyChangeListener, rotateSessionId, setContext, setExpiredSessions, setMaxActive, setNotifyAttributeListenerOnUnchangedValue, setNotifyBindingListenerOnUnchangedValue, setSessionActivityCheck, setSessionCounter, setSessionIdGenerator, setSessionLastAccessAtStart, setSessionMaxAliveTime, willAttributeDistribute`

## Field Details

### sm

protected static final StringManager sm
String manager for this class.

### cluster

protected CatalinaCluster cluster
A reference to the cluster

## Constructor Details

### ClusterManagerBase

public ClusterManagerBase()
Default constructor for ClusterManagerBase.

## Method Details

### getDeltaRequestPool

protected SynchronizedStack<DeltaRequest> getDeltaRequestPool()
Returns the pool of DeltaRequest objects.

Returns:
  the delta request pool

### getCluster

public CatalinaCluster getCluster()
Description copied from interface: `ClusterManager`
Returns the cluster associated with this manager.

Specified by:
  `getCluster` in interface `ClusterManager`
Returns:
  the cluster associated with this manager

### setCluster

public void setCluster(CatalinaCluster cluster)
Description copied from interface: `ClusterManager`
Set the cluster associated with this manager.

Specified by:
  `setCluster` in interface `ClusterManager`
Parameters:
  `cluster` - the cluster

### isNotifyListenersOnReplication

public boolean isNotifyListenersOnReplication()
Description copied from interface: `ClusterManager`
Returns whether listeners are notified on replication.

Specified by:
  `isNotifyListenersOnReplication` in interface `ClusterManager`
Returns:
  `true` if listeners are notified on replication

### setNotifyListenersOnReplication

public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
Sets whether listeners should be notified on replication.

Parameters:
  `notifyListenersOnReplication` - the new value

### isRecordAllActions

public boolean isRecordAllActions()
Returns whether all session attribute actions should be recorded.

Returns:
  `true` if all actions are recorded

### setRecordAllActions

public void setRecordAllActions(boolean recordAllActions)
Sets whether all session attribute actions should be recorded.

Parameters:
  `recordAllActions` - the new value

### getClassLoaders

public static ClassLoader[] getClassLoaders(Context context)
Returns the class loaders for the specified context.

Parameters:
  `context` - the context
Returns:
  the array of class loaders

### getClassLoaders

public ClassLoader[] getClassLoaders()
Returns the class loaders for this manager's context.

Returns:
  the array of class loaders

### getReplicationStream

public ReplicationStream getReplicationStream(byte[] data) throws IOException
Description copied from interface: `ClusterManager`
Open stream and use correct ClassLoader (Container), switching thread context class loader.

Specified by:
  `getReplicationStream` in interface `ClusterManager`
Parameters:
  `data` - the data
Returns:
  the object input stream
Throws:
  `IOException` - An error occurred

### getReplicationStream

public ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException
Description copied from interface: `ClusterManager`
Open stream and use correct ClassLoader (Container), switching thread context class loader.

Specified by:
  `getReplicationStream` in interface `ClusterManager`
Parameters:
  `data` - the data
  `offset` - the offset in the data array
  `length` - the data length
Returns:
  the object input stream
Throws:
  `IOException` - An error occurred

### load

public void load()
`Manager` implementations that also implement `ClusterManager` do not support local session persistence.

Specified by:
  `load` in interface `Manager`

### unload

public void unload()
`Manager` implementations that also implement `ClusterManager` do not support local session persistence.

Specified by:
  `unload` in interface `Manager`

### clone

protected void clone(ClusterManagerBase copy)
Clone the configuration from this manager to the specified copy.

Parameters:
  `copy` - the manager to clone to

### registerSessionAtReplicationValve

protected void registerSessionAtReplicationValve(DeltaSession session)
Register cross context session at replication valve thread local

Parameters:
  `session` - cross context session

### startInternal

protected void startInternal() throws LifecycleException
Description copied from class: `LifecycleBase`
Subclasses must ensure that the state is changed to `LifecycleState.STARTING` during the execution of this method. Changing state will trigger the `Lifecycle.START_EVENT` event. If a component fails to start it may either throw a `LifecycleException` which will cause it's parent to fail to start, or it can place itself in the error state in which case `LifecycleBase.stop()` will be called on the failed component but the parent component will continue to start normally.

Overrides:
  `startInternal` in class `ManagerBase`
Throws:
  `LifecycleException` - Start error occurred

### stopInternal

protected void stopInternal() throws LifecycleException
Description copied from class: `LifecycleBase`
Subclasses must ensure that the state is changed to `LifecycleState.STOPPING` during the execution of this method. Changing state will trigger the `Lifecycle.STOP_EVENT` event.

Overrides:
  `stopInternal` in class `ManagerBase`
Throws:
  `LifecycleException` - Stop error occurred