Package org.apache.catalina.ha.session
Class DeltaManager
- java.lang.Object
- 
- org.apache.catalina.util.LifecycleBase
- 
- org.apache.catalina.util.LifecycleMBeanBase
- 
- org.apache.catalina.session.ManagerBase
- 
- org.apache.catalina.ha.session.ClusterManagerBase
- 
- org.apache.catalina.ha.session.DeltaManager
 
 
 
 
 
- 
- All Implemented Interfaces:
- javax.management.MBeanRegistration,- ClusterManager,- JmxEnabled,- Lifecycle,- Manager
 
 public class DeltaManager extends ClusterManagerBase The DeltaManager manages replicated sessions by only replicating the deltas in data. For applications written to handle this, the DeltaManager is the optimal way of replicating data. This code is almost identical to StandardManager with a difference in how it persists sessions and some modifications to it. IMPLEMENTATION NOTE : Correct behavior of session storing and reloading depends upon external calls to thestart()andstop()methods of this class at the correct times.- Author:
- Craig R. McClanahan, Peter Rossbach
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.catalina.session.ManagerBaseManagerBase.SessionTiming
 - 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description Loglogprotected static java.lang.StringmanagerNameDeprecated.Unused.protected java.lang.Stringnameprotected static StringManagersmThe string manager for this package.- 
Fields inherited from class org.apache.catalina.ha.session.ClusterManagerBasecluster
 - 
Fields inherited from class org.apache.catalina.session.ManagerBaseduplicates, expiredSessions, maxActive, maxActiveSessions, processExpiresFrequency, processingTime, rejectedSessions, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdGenerator, sessionIdGeneratorClass, sessionMaxAliveTime, sessions, support, TIMING_STATS_CACHE_SIZE
 - 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBasemserver
 - 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_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 SummaryConstructors Constructor Description DeltaManager()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidchangeSessionId(Session session)Change the session ID of the current session to a new randomly generated session ID.protected voidchangeSessionId(Session session, boolean notify)voidchangeSessionId(Session session, java.lang.String newId)Change the session ID of the current session to a specified session ID.protected voidchangeSessionId(Session session, java.lang.String newId, boolean notify)ClusterManagercloneFromTemplate()SessioncreateEmptySession()Get a session from the recycled ones or create a new empty one.SessioncreateSession(java.lang.String sessionId)Construct and return a new session object, based on the default settings specified by this Manager's properties.SessioncreateSession(java.lang.String sessionId, boolean distribute)Create new session with check maxActiveSessions and send session creation to other cluster nodes.protected DeltaRequestdeserializeDeltaRequest(DeltaSession session, byte[] data)Deprecated.Unused.protected java.lang.StringdeserializeSessionId(byte[] data)Load sessionIDprotected voiddeserializeSessions(byte[] data)Load sessions from other cluster node.voidexpireAllLocalSessions()Expire all find sessions.protected MemberfindSessionMasterMember()Find the master of the session statevoidgetAllClusterSessions()get from first session master the backup from all clustered sessionsintgetCounterNoStateTransfered()Deprecated.intgetCounterNoStateTransferred()longgetCounterReceive_EVT_ALL_SESSION_DATA()longgetCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER()intgetCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE()longgetCounterReceive_EVT_CHANGE_SESSION_ID()longgetCounterReceive_EVT_GET_ALL_SESSIONS()longgetCounterReceive_EVT_SESSION_ACCESSED()longgetCounterReceive_EVT_SESSION_CREATED()longgetCounterReceive_EVT_SESSION_DELTA()longgetCounterReceive_EVT_SESSION_EXPIRED()longgetCounterSend_EVT_ALL_SESSION_DATA()intgetCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE()longgetCounterSend_EVT_CHANGE_SESSION_ID()longgetCounterSend_EVT_GET_ALL_SESSIONS()longgetCounterSend_EVT_SESSION_ACCESSED()longgetCounterSend_EVT_SESSION_CREATED()longgetCounterSend_EVT_SESSION_DELTA()longgetCounterSend_EVT_SESSION_EXPIRED()java.lang.String[]getInvalidatedSessions()When the manager expires session not tied to a request.java.lang.StringgetName()Return the name of the manager, at host /context name and at engine hostname+/context.protected DeltaSessiongetNewDeltaSession()Deprecated.Unused.longgetProcessingTime()intgetReceivedQueueSize()intgetSendAllSessionsSize()intgetSendAllSessionsWaitTime()longgetSessionReplaceCounter()booleangetStateTransfered()Deprecated.booleangetStateTransferred()intgetStateTransferTimeout()protected voidhandleALL_SESSION_DATA(SessionMessage msg, Member sender)handle receive sessions from other not ( restart )protected voidhandleALL_SESSION_NOCONTEXTMANAGER(SessionMessage msg, Member sender)handle receive no context manager.protected voidhandleALL_SESSION_TRANSFERCOMPLETE(SessionMessage msg, Member sender)handle receive session state is complete transferredprotected voidhandleCHANGE_SESSION_ID(SessionMessage msg, Member sender)handle receive change sessionID at other nodeprotected voidhandleGET_ALL_SESSIONS(SessionMessage msg, Member sender)handle receive that other node want all sessions ( restart ) a) send all sessions with one message b) send session at blocks After sending send state is complete transferredprotected voidhandleSESSION_ACCESSED(SessionMessage msg, Member sender)handle receive session is access at other node ( primary session is now false)protected voidhandleSESSION_CREATED(SessionMessage msg, Member sender)handle receive new session is created at other node (create backup - primary false)protected voidhandleSESSION_DELTA(SessionMessage msg, Member sender)handle receive session deltaprotected voidhandleSESSION_EXPIRED(SessionMessage msg, Member sender)handle receive session is expire at other node ( expire session also here)booleanisExpireSessionsOnShutdown()booleanisNoContextManagerReceived()booleanisNotifyContainerListenersOnReplication()booleanisNotifySessionListenersOnReplication()booleanisSendAllSessions()booleanisStateTimestampDrop()voidmessageDataReceived(ClusterMessage cmsg)A message was received from another node, this is the callback method to implement if you are interested in receiving replication messages.protected voidmessageReceived(SessionMessage msg, Member sender)This method is called by the received thread when a SessionMessage has been received from one of the other nodes in the cluster.ClusterMessagerequestCompleted(java.lang.String sessionId)When the request has been completed, the replication valve will notify the manager, and the manager will decide whether any replication is needed or not.ClusterMessagerequestCompleted(java.lang.String sessionId, boolean expires)When the request has been completed, the replication valve will notify the manager, and the manager will decide whether any replication is needed or not.voidresetStatistics()Reset manager statisticsjava.lang.StringrotateSessionId(Session session)protected java.lang.StringrotateSessionId(Session session, boolean notify)protected voidsend(SessionMessage msg)Send messages to other backup member (domain or all)protected voidsendChangeSessionId(java.lang.String newSessionID, java.lang.String orgSessionID)protected voidsendCreateSession(java.lang.String sessionId, DeltaSession session)Send create session event to all backup nodeprotected voidsendSessions(Member sender, Session[] currentSessions, long sendTimestamp)send a block of session to senderprotected byte[]serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest)Deprecated.Unused.protected byte[]serializeSessionId(java.lang.String sessionId)serialize sessionIDprotected byte[]serializeSessions(Session[] currentSessions)Save any currently active sessions in the appropriate persistence mechanism, if any.protected voidsessionExpired(java.lang.String id)send session expired to other cluster nodesvoidsetExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)voidsetName(java.lang.String name)Set the name of the manager, at host /context name and at engine hostname+/contextvoidsetNoContextManagerReceived(boolean noContextManagerReceived)voidsetNotifyContainerListenersOnReplication(boolean notifyContainerListenersOnReplication)voidsetNotifySessionListenersOnReplication(boolean notifyListenersCreateSessionOnReplication)voidsetSendAllSessions(boolean sendAllSessions)voidsetSendAllSessionsSize(int sendAllSessionsSize)voidsetSendAllSessionsWaitTime(int sendAllSessionsWaitTime)voidsetStateTimestampDrop(boolean isTimestampDrop)voidsetStateTransfered(boolean stateTransferred)Deprecated.voidsetStateTransferred(boolean stateTransferred)Set that state transferred is completevoidsetStateTransferTimeout(int timeoutAllSession)protected voidstartInternal()Start this component and implement the requirements ofLifecycleBase.startInternal().protected voidstopInternal()Stop this component and implement the requirements ofLifecycleBase.stopInternal().protected voidwaitForSendAllSessions(long beforeSendTime)Wait that cluster session state is transferred or timeout after 60 Sec With stateTransferTimeout == -1 wait that backup is transferred (forever mode)- 
Methods inherited from class org.apache.catalina.ha.session.ClusterManagerBaseclone, getClassLoaders, getClassLoaders, getCluster, getDeltaRequestPool, getReplicationStream, getReplicationStream, isNotifyListenersOnReplication, isRecordAllActions, load, registerSessionAtReplicationValve, setCluster, setNotifyListenersOnReplication, setRecordAllActions, unload
 - 
Methods inherited from class org.apache.catalina.session.ManagerBaseadd, addPropertyChangeListener, backgroundProcess, changeSessionId, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getClassName, getContext, getCreationTime, getCreationTimestamp, getDomainInternal, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getNewSession, getObjectNameKeyProperties, getPersistAuthentication, getPersistAuthenticationNotes, getProcessExpiresFrequency, getRejectedSessions, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, getSession, getSessionAttribute, getSessionAttributeNameFilter, getSessionAttributeNamePattern, getSessionAttributeValueClassNameFilter, getSessionAttributeValueClassNamePattern, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionMaxAliveTime, getThisAccessedTime, getThisAccessedTimestamp, getWarnOnSessionAttributeFilterFailure, initInternal, listSessionIds, processExpires, remove, remove, removePropertyChangeListener, setContext, setDuplicates, setExpiredSessions, setMaxActive, setMaxActiveSessions, setPersistAuthentication, setPersistAuthenticationNotes, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionAttributeNameFilter, setSessionAttributeValueClassNameFilter, setSessionCounter, setSessionIdGenerator, setSessionMaxAliveTime, setWarnOnSessionAttributeFilterFailure, toString, updateSessionMaxAliveTime, willAttributeDistribute
 - 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBasedestroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
 - 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.Manageradd, addPropertyChangeListener, backgroundProcess, findSession, findSessions, getActiveSessions, getContext, getExpiredSessions, getMaxActive, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionMaxAliveTime, remove, remove, removePropertyChangeListener, setContext, setExpiredSessions, setMaxActive, setSessionCounter, setSessionIdGenerator, setSessionMaxAliveTime, willAttributeDistribute
 
- 
 
- 
- 
- 
Field Detail- 
logpublic final Log log 
 - 
smprotected static final StringManager sm The string manager for this package.
 - 
managerName@Deprecated protected static final java.lang.String managerName Deprecated.Unused. Will be removed in Tomcat 9The descriptive name of this Manager implementation (for logging).- See Also:
- Constant Field Values
 
 - 
nameprotected java.lang.String name 
 
- 
 - 
Method Detail- 
setNamepublic void setName(java.lang.String name) Description copied from interface:ClusterManagerSet the name of the manager, at host /context name and at engine hostname+/context- Parameters:
- name- The manager name
 
 - 
getNamepublic java.lang.String getName() Description copied from interface:ClusterManagerReturn the name of the manager, at host /context name and at engine hostname+/context.- Specified by:
- getNamein interface- ClusterManager
- Overrides:
- getNamein class- ManagerBase
- Returns:
- The descriptive short name of this Manager implementation.
 
 - 
getCounterSend_EVT_GET_ALL_SESSIONSpublic long getCounterSend_EVT_GET_ALL_SESSIONS() - Returns:
- Returns the counterSend_EVT_GET_ALL_SESSIONS.
 
 - 
getCounterSend_EVT_SESSION_ACCESSEDpublic long getCounterSend_EVT_SESSION_ACCESSED() - Returns:
- Returns the counterSend_EVT_SESSION_ACCESSED.
 
 - 
getCounterSend_EVT_SESSION_CREATEDpublic long getCounterSend_EVT_SESSION_CREATED() - Returns:
- Returns the counterSend_EVT_SESSION_CREATED.
 
 - 
getCounterSend_EVT_SESSION_DELTApublic long getCounterSend_EVT_SESSION_DELTA() - Returns:
- Returns the counterSend_EVT_SESSION_DELTA.
 
 - 
getCounterSend_EVT_SESSION_EXPIREDpublic long getCounterSend_EVT_SESSION_EXPIRED() - Returns:
- Returns the counterSend_EVT_SESSION_EXPIRED.
 
 - 
getCounterSend_EVT_ALL_SESSION_DATApublic long getCounterSend_EVT_ALL_SESSION_DATA() - Returns:
- Returns the counterSend_EVT_ALL_SESSION_DATA.
 
 - 
getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETEpublic int getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE() - Returns:
- Returns the counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE.
 
 - 
getCounterSend_EVT_CHANGE_SESSION_IDpublic long getCounterSend_EVT_CHANGE_SESSION_ID() - Returns:
- Returns the counterSend_EVT_CHANGE_SESSION_ID.
 
 - 
getCounterReceive_EVT_ALL_SESSION_DATApublic long getCounterReceive_EVT_ALL_SESSION_DATA() - Returns:
- Returns the counterReceive_EVT_ALL_SESSION_DATA.
 
 - 
getCounterReceive_EVT_GET_ALL_SESSIONSpublic long getCounterReceive_EVT_GET_ALL_SESSIONS() - Returns:
- Returns the counterReceive_EVT_GET_ALL_SESSIONS.
 
 - 
getCounterReceive_EVT_SESSION_ACCESSEDpublic long getCounterReceive_EVT_SESSION_ACCESSED() - Returns:
- Returns the counterReceive_EVT_SESSION_ACCESSED.
 
 - 
getCounterReceive_EVT_SESSION_CREATEDpublic long getCounterReceive_EVT_SESSION_CREATED() - Returns:
- Returns the counterReceive_EVT_SESSION_CREATED.
 
 - 
getCounterReceive_EVT_SESSION_DELTApublic long getCounterReceive_EVT_SESSION_DELTA() - Returns:
- Returns the counterReceive_EVT_SESSION_DELTA.
 
 - 
getCounterReceive_EVT_SESSION_EXPIREDpublic long getCounterReceive_EVT_SESSION_EXPIRED() - Returns:
- Returns the counterReceive_EVT_SESSION_EXPIRED.
 
 - 
getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETEpublic int getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE() - Returns:
- Returns the counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE.
 
 - 
getCounterReceive_EVT_CHANGE_SESSION_IDpublic long getCounterReceive_EVT_CHANGE_SESSION_ID() - Returns:
- Returns the counterReceive_EVT_CHANGE_SESSION_ID.
 
 - 
getCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGERpublic long getCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER() - Returns:
- Returns the counterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER.
 
 - 
getProcessingTimepublic long getProcessingTime() - Overrides:
- getProcessingTimein class- ManagerBase
- Returns:
- Returns the processingTime.
 
 - 
getSessionReplaceCounterpublic long getSessionReplaceCounter() - Returns:
- Returns the sessionReplaceCounter.
 
 - 
getCounterNoStateTransfered@Deprecated public int getCounterNoStateTransfered() Deprecated.UsegetCounterNoStateTransferred(). Will be removed in Tomcat 10 onwards.- Returns:
- Returns the counterNoStateTransferred.
 
 - 
getCounterNoStateTransferredpublic int getCounterNoStateTransferred() - Returns:
- Returns the counterNoStateTransferred.
 
 - 
getReceivedQueueSizepublic int getReceivedQueueSize() 
 - 
getStateTransferTimeoutpublic int getStateTransferTimeout() - Returns:
- Returns the stateTransferTimeout.
 
 - 
setStateTransferTimeoutpublic void setStateTransferTimeout(int timeoutAllSession) - Parameters:
- timeoutAllSession- The timeout
 
 - 
getStateTransfered@Deprecated public boolean getStateTransfered() Deprecated.UsegetStateTransferred(). Will be removed in Tomcat 10 onwards.- Returns:
- trueif the state transfer is complete.
 
 - 
setStateTransfered@Deprecated public void setStateTransfered(boolean stateTransferred) Deprecated.UsesetStateTransferred(boolean). Will be removed in Tomcat 10 onwards.Set that state transferred is complete- Parameters:
- stateTransferred- Flag value
 
 - 
getStateTransferredpublic boolean getStateTransferred() - Returns:
- trueif the state transfer is complete.
 
 - 
setStateTransferredpublic void setStateTransferred(boolean stateTransferred) Set that state transferred is complete- Parameters:
- stateTransferred- Flag value
 
 - 
isNoContextManagerReceivedpublic boolean isNoContextManagerReceived() 
 - 
setNoContextManagerReceivedpublic void setNoContextManagerReceived(boolean noContextManagerReceived) 
 - 
getSendAllSessionsWaitTimepublic int getSendAllSessionsWaitTime() - Returns:
- the sendAllSessionsWaitTime in msec
 
 - 
setSendAllSessionsWaitTimepublic void setSendAllSessionsWaitTime(int sendAllSessionsWaitTime) - Parameters:
- sendAllSessionsWaitTime- The sendAllSessionsWaitTime to set at msec.
 
 - 
isStateTimestampDroppublic boolean isStateTimestampDrop() - Returns:
- the stateTimestampDrop.
 
 - 
setStateTimestampDroppublic void setStateTimestampDrop(boolean isTimestampDrop) - Parameters:
- isTimestampDrop- The new flag value
 
 - 
isSendAllSessionspublic boolean isSendAllSessions() - Returns:
- the sendAllSessions.
 
 - 
setSendAllSessionspublic void setSendAllSessions(boolean sendAllSessions) - Parameters:
- sendAllSessions- The sendAllSessions to set.
 
 - 
getSendAllSessionsSizepublic int getSendAllSessionsSize() - Returns:
- the sendAllSessionsSize.
 
 - 
setSendAllSessionsSizepublic void setSendAllSessionsSize(int sendAllSessionsSize) - Parameters:
- sendAllSessionsSize- The sendAllSessionsSize to set.
 
 - 
isNotifySessionListenersOnReplicationpublic boolean isNotifySessionListenersOnReplication() - Returns:
- the notifySessionListenersOnReplication.
 
 - 
setNotifySessionListenersOnReplicationpublic void setNotifySessionListenersOnReplication(boolean notifyListenersCreateSessionOnReplication) - Parameters:
- notifyListenersCreateSessionOnReplication- The notifySessionListenersOnReplication to set.
 
 - 
isExpireSessionsOnShutdownpublic boolean isExpireSessionsOnShutdown() 
 - 
setExpireSessionsOnShutdownpublic void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown) 
 - 
isNotifyContainerListenersOnReplicationpublic boolean isNotifyContainerListenersOnReplication() 
 - 
setNotifyContainerListenersOnReplicationpublic void setNotifyContainerListenersOnReplication(boolean notifyContainerListenersOnReplication) 
 - 
createSessionpublic Session createSession(java.lang.String sessionId) Description copied from interface:ManagerConstruct and return a new session object, based on the default settings specified by this Manager's properties. The session id specified will be used as the session id. If a new session cannot be created for any reason, returnnull.- Specified by:
- createSessionin interface- Manager
- Overrides:
- createSessionin class- ManagerBase
- Parameters:
- sessionId- The session id which should be used to create the new session; if- null, the session id will be assigned by this method, and available via the getId() method of the returned session.
- Returns:
- An empty Session object with the given ID or a newly created session ID if none was specified
 
 - 
createSessionpublic Session createSession(java.lang.String sessionId, boolean distribute) Create new session with check maxActiveSessions and send session creation to other cluster nodes.- Parameters:
- sessionId- The session id that should be used for the session
- distribute-- trueto replicate the new session
- Returns:
- The session
 
 - 
sendCreateSessionprotected void sendCreateSession(java.lang.String sessionId, DeltaSession session)Send create session event to all backup node- Parameters:
- sessionId- The session id of the session
- session- The session object
 
 - 
sendprotected void send(SessionMessage msg) Send messages to other backup member (domain or all)- Parameters:
- msg- Session message
 
 - 
createEmptySessionpublic Session createEmptySession() Get a session from the recycled ones or create a new empty one. The PersistentManager manager does not need to create session data because it reads it from the Store.Creates new DeltaSession instance. - Specified by:
- createEmptySessionin interface- Manager
- Overrides:
- createEmptySessionin class- ManagerBase
- Returns:
- An empty Session object
 
 - 
getNewDeltaSession@Deprecated protected DeltaSession getNewDeltaSession() Deprecated.Unused. This will be removed in Tomcat 10.Get new session class to be used in the doLoad() method.- Returns:
- a new session
 
 - 
changeSessionIdpublic void changeSessionId(Session session) Description copied from interface:ManagerChange the session ID of the current session to a new randomly generated session ID.- Specified by:
- changeSessionIdin interface- Manager
- Overrides:
- changeSessionIdin class- ManagerBase
- Parameters:
- session- The session to change the session ID for
 
 - 
rotateSessionIdpublic java.lang.String rotateSessionId(Session session) - Overrides:
- rotateSessionIdin class- ManagerBase
 
 - 
changeSessionIdpublic void changeSessionId(Session session, java.lang.String newId) Description copied from interface:ManagerChange the session ID of the current session to a specified session ID.- Specified by:
- changeSessionIdin interface- Manager
- Overrides:
- changeSessionIdin class- ManagerBase
- Parameters:
- session- The session to change the session ID for
- newId- new session ID
 
 - 
changeSessionIdprotected void changeSessionId(Session session, boolean notify) 
 - 
rotateSessionIdprotected java.lang.String rotateSessionId(Session session, boolean notify) 
 - 
changeSessionIdprotected void changeSessionId(Session session, java.lang.String newId, boolean notify) 
 - 
sendChangeSessionIdprotected void sendChangeSessionId(java.lang.String newSessionID, java.lang.String orgSessionID)
 - 
serializeSessionIdprotected byte[] serializeSessionId(java.lang.String sessionId) throws java.io.IOExceptionserialize sessionID- Parameters:
- sessionId- Session id to serialize
- Returns:
- byte array with serialized session id
- Throws:
- java.io.IOException- if an input/output error occurs
 
 - 
deserializeSessionIdprotected java.lang.String deserializeSessionId(byte[] data) throws java.io.IOExceptionLoad sessionID- Parameters:
- data- serialized session id
- Returns:
- session id
- Throws:
- java.io.IOException- if an input/output error occurs
 
 - 
deserializeDeltaRequest@Deprecated protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data) throws java.lang.ClassNotFoundException, java.io.IOException Deprecated.Unused. This will be removed in Tomcat 10. Calling this method may result in a deadlock. See: https://bz.apache.org/bugzilla/show_bug.cgi?id=62841Load Deltarequest from external node Load the Class at container classloader- Parameters:
- session- Corresponding session
- data- message data
- Returns:
- The request
- Throws:
- java.lang.ClassNotFoundException- Serialization error
- java.io.IOException- IO error with serialization
- See Also:
- DeltaRequest.readExternal(java.io.ObjectInput)
 
 - 
serializeDeltaRequest@Deprecated protected byte[] serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest) throws java.io.IOException Deprecated.Unused. This will be removed in Tomcat 10. Calling this method may result in a deadlock. See: https://bz.apache.org/bugzilla/show_bug.cgi?id=62841serialize DeltaRequest- Parameters:
- session- Associated session
- deltaRequest- The request to serialize
- Returns:
- serialized delta request
- Throws:
- java.io.IOException- IO error with serialization
- See Also:
- DeltaRequest.writeExternal(java.io.ObjectOutput)
 
 - 
deserializeSessionsprotected void deserializeSessions(byte[] data) throws java.lang.ClassNotFoundException, java.io.IOExceptionLoad sessions from other cluster node. FIXME replace currently sessions with same id without notification. FIXME SSO handling is not really correct with the session replacement!- Parameters:
- data- Serialized data
- Throws:
- java.lang.ClassNotFoundException- if a serialized class cannot be found during the reload
- java.io.IOException- if an input/output error occurs
 
 - 
serializeSessionsprotected byte[] serializeSessions(Session[] currentSessions) 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.- Parameters:
- currentSessions- Sessions to serialize
- Returns:
- serialized data
- Throws:
- java.io.IOException- if an input/output error occurs
 
 - 
startInternalprotected void startInternal() throws LifecycleExceptionStart this component and implement the requirements ofLifecycleBase.startInternal().- Overrides:
- startInternalin class- ClusterManagerBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
 - 
getAllClusterSessionspublic void getAllClusterSessions() get from first session master the backup from all clustered sessions- See Also:
- findSessionMasterMember()
 
 - 
findSessionMasterMemberprotected Member findSessionMasterMember() Find the master of the session state- Returns:
- master member of sessions
 
 - 
waitForSendAllSessionsprotected void waitForSendAllSessions(long beforeSendTime) Wait that cluster session state is transferred or timeout after 60 Sec With stateTransferTimeout == -1 wait that backup is transferred (forever mode)- Parameters:
- beforeSendTime- Start instant of the operation
 
 - 
stopInternalprotected void stopInternal() throws LifecycleExceptionStop this component and implement the requirements ofLifecycleBase.stopInternal().- Overrides:
- stopInternalin class- ClusterManagerBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
 - 
messageDataReceivedpublic void messageDataReceived(ClusterMessage cmsg) A message was received from another node, this is the callback method to implement if you are interested in receiving replication messages.- Parameters:
- cmsg- - the message received.
 
 - 
requestCompletedpublic ClusterMessage requestCompleted(java.lang.String sessionId) When the request has been completed, the replication valve will notify the manager, and the manager will decide whether any replication is needed or not. If there is a need for replication, the manager will create a session message and that will be replicated. The cluster determines where it gets sent.- Parameters:
- sessionId- - the sessionId that just completed.
- Returns:
- a SessionMessage to be sent,
 
 - 
requestCompletedpublic ClusterMessage requestCompleted(java.lang.String sessionId, boolean expires) When the request has been completed, the replication valve will notify the manager, and the manager will decide whether any replication is needed or not. If there is a need for replication, the manager will create a session message and that will be replicated. The cluster determines where it gets sent. Session expiration also calls this method, but with expires == true.- Parameters:
- sessionId- - the sessionId that just completed.
- expires- - whether this method has been called during session expiration
- Returns:
- a SessionMessage to be sent,
 
 - 
resetStatisticspublic void resetStatistics() Reset manager statistics
 - 
sessionExpiredprotected void sessionExpired(java.lang.String id) send session expired to other cluster nodes- Parameters:
- id- session id
 
 - 
expireAllLocalSessionspublic void expireAllLocalSessions() Expire all find sessions.
 - 
getInvalidatedSessionspublic java.lang.String[] getInvalidatedSessions() Description copied from interface:ClusterManagerWhen the manager expires session not tied to a request. The cluster will periodically ask for a list of sessions that should expire and that should be sent across the wire.- Returns:
- String[] The invalidated sessions
 
 - 
messageReceivedprotected void messageReceived(SessionMessage msg, Member sender) This method is called by the received thread when a SessionMessage has been received from one of the other nodes in the cluster.- Parameters:
- msg- - the message received
- sender- - the sender of the message, this is used if we receive a EVT_GET_ALL_SESSION message, so that we only reply to the requesting node
 
 - 
handleALL_SESSION_TRANSFERCOMPLETEprotected void handleALL_SESSION_TRANSFERCOMPLETE(SessionMessage msg, Member sender) handle receive session state is complete transferred- Parameters:
- msg- Session message
- sender- Member which sent the message
 
 - 
handleSESSION_DELTAprotected void handleSESSION_DELTA(SessionMessage msg, Member sender) throws java.io.IOException, java.lang.ClassNotFoundException handle receive session delta- Parameters:
- msg- Session message
- sender- Member which sent the message
- Throws:
- java.io.IOException- IO error with serialization
- java.lang.ClassNotFoundException- Serialization error
 
 - 
handleSESSION_ACCESSEDprotected void handleSESSION_ACCESSED(SessionMessage msg, Member sender) throws java.io.IOException handle receive session is access at other node ( primary session is now false)- Parameters:
- msg- Session message
- sender- Member which sent the message
- Throws:
- java.io.IOException- Propagated IO error
 
 - 
handleSESSION_EXPIREDprotected void handleSESSION_EXPIRED(SessionMessage msg, Member sender) throws java.io.IOException handle receive session is expire at other node ( expire session also here)- Parameters:
- msg- Session message
- sender- Member which sent the message
- Throws:
- java.io.IOException- Propagated IO error
 
 - 
handleSESSION_CREATEDprotected void handleSESSION_CREATED(SessionMessage msg, Member sender) handle receive new session is created at other node (create backup - primary false)- Parameters:
- msg- Session message
- sender- Member which sent the message
 
 - 
handleALL_SESSION_DATAprotected void handleALL_SESSION_DATA(SessionMessage msg, Member sender) throws java.lang.ClassNotFoundException, java.io.IOException handle receive sessions from other not ( restart )- Parameters:
- msg- Session message
- sender- Member which sent the message
- Throws:
- java.lang.ClassNotFoundException- Serialization error
- java.io.IOException- IO error with serialization
 
 - 
handleGET_ALL_SESSIONSprotected void handleGET_ALL_SESSIONS(SessionMessage msg, Member sender) throws java.io.IOException handle receive that other node want all sessions ( restart ) a) send all sessions with one message b) send session at blocks After sending send state is complete transferred- Parameters:
- msg- Session message
- sender- Member which sent the message
- Throws:
- java.io.IOException- IO error sending messages
 
 - 
handleCHANGE_SESSION_IDprotected void handleCHANGE_SESSION_ID(SessionMessage msg, Member sender) throws java.io.IOException handle receive change sessionID at other node- Parameters:
- msg- Session message
- sender- Member which sent the message
- Throws:
- java.io.IOException- IO error with serialization
 
 - 
handleALL_SESSION_NOCONTEXTMANAGERprotected void handleALL_SESSION_NOCONTEXTMANAGER(SessionMessage msg, Member sender) handle receive no context manager.- Parameters:
- msg- Session message
- sender- Member which sent the message
 
 - 
sendSessionsprotected void sendSessions(Member sender, Session[] currentSessions, long sendTimestamp) throws java.io.IOException send a block of session to sender- Parameters:
- sender- Sender member
- currentSessions- Sessions to send
- sendTimestamp- Timestamp
- Throws:
- java.io.IOException- IO error sending messages
 
 - 
cloneFromTemplatepublic ClusterManager cloneFromTemplate() 
 
- 
 
-