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:
MBeanRegistration
,ClusterManager
,JmxEnabled
,Lifecycle
,Manager
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 the
start()
and stop()
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.ManagerBase
ManagerBase.SessionTiming
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
Field Summary
Modifier and TypeFieldDescriptionfinal Log
protected String
protected static final StringManager
The string manager for this package.Fields inherited from class org.apache.catalina.ha.session.ClusterManagerBase
cluster
Fields inherited from class org.apache.catalina.session.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 class org.apache.catalina.util.LifecycleMBeanBase
mserver
Fields inherited from interface org.apache.catalina.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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changeSessionId
(Session session) Change the session ID of the current session to a new randomly generated session ID.protected void
changeSessionId
(Session session, boolean notify) Deprecated.Will be removed in Tomcat 10void
changeSessionId
(Session session, String newId) Change the session ID of the current session to a specified session ID.protected void
changeSessionId
(Session session, String newId, boolean notify) Get a session from the recycled ones or create a new empty one.createSession
(String sessionId) Construct and return a new session object, based on the default settings specified by this Manager's properties.createSession
(String sessionId, boolean distribute) Create new session with check maxActiveSessions and send session creation to other cluster nodes.protected DeltaRequest
deserializeDeltaRequest
(DeltaSession session, byte[] data) Deprecated.Unused.protected String
deserializeSessionId
(byte[] data) Load sessionIDprotected void
deserializeSessions
(byte[] data) Load sessions from other cluster node.void
Expire all find sessions.protected Member
Find the master of the session statevoid
get from first session master the backup from all clustered sessionsint
Deprecated.int
long
long
int
long
long
long
long
long
long
long
int
long
long
long
long
long
long
String[]
When the manager expires session not tied to a request.getName()
Return the name of the manager, at host /context name and at engine hostname+/context.protected DeltaSession
Deprecated.Unused.int
int
int
long
boolean
Deprecated.boolean
int
protected void
handleALL_SESSION_DATA
(SessionMessage msg, Member sender) handle receive sessions from other not ( restart )protected void
handleALL_SESSION_NOCONTEXTMANAGER
(SessionMessage msg, Member sender) handle receive no context manager.protected void
handleALL_SESSION_TRANSFERCOMPLETE
(SessionMessage msg, Member sender) handle receive session state is complete transferredprotected void
handleCHANGE_SESSION_ID
(SessionMessage msg, Member sender) handle receive change sessionID at other nodeprotected void
handleGET_ALL_SESSIONS
(SessionMessage msg, Member sender) Handle a get all sessions message from another node.protected void
handleSESSION_ACCESSED
(SessionMessage msg, Member sender) handle receive session is access at other node ( primary session is now false)protected void
handleSESSION_CREATED
(SessionMessage msg, Member sender) handle receive new session is created at other node (create backup - primary false)protected void
handleSESSION_DELTA
(SessionMessage msg, Member sender) handle receive session deltaprotected void
handleSESSION_EXPIRED
(SessionMessage msg, Member sender) handle receive session is expire at other node ( expire session also here)boolean
boolean
boolean
boolean
boolean
boolean
void
A message was received from another node, this is the callback method to implement if you are interested in receiving replication messages.protected 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.requestCompleted
(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.requestCompleted
(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.void
Reset manager statisticsrotateSessionId
(Session session) Change the session ID of the current session to a new randomly generated session ID.protected String
rotateSessionId
(Session session, boolean notify) protected void
send
(SessionMessage msg) Send messages to other backup member (domain or all)protected void
sendChangeSessionId
(String newSessionID, String orgSessionID) protected void
sendCreateSession
(String sessionId, DeltaSession session) Send create session event to all backup nodeprotected void
sendSessions
(Member sender, Session[] currentSessions, long sendTimestamp) send a block of session to senderprotected byte[]
serializeDeltaRequest
(DeltaSession session, DeltaRequest deltaRequest) Deprecated.Unused.protected byte[]
serializeSessionId
(String sessionId) serialize sessionIDprotected byte[]
serializeSessions
(Session[] currentSessions) Save any currently active sessions in the appropriate persistence mechanism, if any.protected void
sessionExpired
(String id) send session expired to other cluster nodesvoid
setExpireSessionsOnShutdown
(boolean expireSessionsOnShutdown) void
Set the name of the manager, at host /context name and at engine hostname+/contextvoid
setNoContextManagerReceived
(boolean noContextManagerReceived) void
setNotifyContainerListenersOnReplication
(boolean notifyContainerListenersOnReplication) void
setNotifySessionListenersOnReplication
(boolean notifyListenersCreateSessionOnReplication) void
setSendAllSessions
(boolean sendAllSessions) void
setSendAllSessionsSize
(int sendAllSessionsSize) void
setSendAllSessionsWaitTime
(int sendAllSessionsWaitTime) void
setStateTimestampDrop
(boolean isTimestampDrop) void
setStateTransfered
(boolean stateTransferred) Deprecated.void
setStateTransferred
(boolean stateTransferred) Set that state transferred is completevoid
setStateTransferTimeout
(int timeoutAllSession) protected void
Start this component and implement the requirements ofLifecycleBase.startInternal()
.protected void
Stop this component and implement the requirements ofLifecycleBase.stopInternal()
.protected 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)Methods inherited from class org.apache.catalina.ha.session.ClusterManagerBase
clone, getClassLoaders, getClassLoaders, getCluster, getDeltaRequestPool, getReplicationStream, getReplicationStream, isNotifyListenersOnReplication, isRecordAllActions, load, registerSessionAtReplicationValve, setCluster, setNotifyListenersOnReplication, setRecordAllActions, unload
Methods inherited from class org.apache.catalina.session.ManagerBase
add, addPropertyChangeListener, backgroundProcess, changeSessionId, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getClassName, getContext, getCreationTime, getCreationTimestamp, getDomainInternal, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getNewSession, getNotifyAttributeListenerOnUnchangedValue, getNotifyBindingListenerOnUnchangedValue, getObjectNameKeyProperties, getPersistAuthentication, getPersistAuthenticationNotes, getProcessExpiresFrequency, getProcessingTime, 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, setNotifyAttributeListenerOnUnchangedValue, setNotifyBindingListenerOnUnchangedValue, setPersistAuthentication, setPersistAuthenticationNotes, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionAttributeNameFilter, setSessionAttributeValueClassNameFilter, setSessionCounter, setSessionIdGenerator, setSessionMaxAliveTime, setWarnOnSessionAttributeFilterFailure, toString, updateSessionMaxAliveTime, willAttributeDistribute
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.catalina.Manager
add, addPropertyChangeListener, backgroundProcess, findSession, findSessions, getActiveSessions, getContext, getExpiredSessions, getMaxActive, getNotifyAttributeListenerOnUnchangedValue, getNotifyBindingListenerOnUnchangedValue, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionMaxAliveTime, remove, remove, removePropertyChangeListener, setContext, setExpiredSessions, setMaxActive, setNotifyAttributeListenerOnUnchangedValue, setNotifyBindingListenerOnUnchangedValue, setSessionCounter, setSessionIdGenerator, setSessionMaxAliveTime, willAttributeDistribute
-
Field Details
-
log
-
sm
The string manager for this package. -
name
-
-
Constructor Details
-
DeltaManager
public DeltaManager()
-
-
Method Details
-
setName
Description copied from interface:ClusterManager
Set the name of the manager, at host /context name and at engine hostname+/context- Parameters:
name
- The manager name
-
getName
Description copied from interface:ClusterManager
Return the name of the manager, at host /context name and at engine hostname+/context.- Specified by:
getName
in interfaceClusterManager
- Overrides:
getName
in classManagerBase
- Returns:
- The descriptive short name of this Manager implementation.
-
getCounterSend_EVT_GET_ALL_SESSIONS
public long getCounterSend_EVT_GET_ALL_SESSIONS()- Returns:
- Returns the counterSend_EVT_GET_ALL_SESSIONS.
-
getCounterSend_EVT_SESSION_ACCESSED
public long getCounterSend_EVT_SESSION_ACCESSED()- Returns:
- Returns the counterSend_EVT_SESSION_ACCESSED.
-
getCounterSend_EVT_SESSION_CREATED
public long getCounterSend_EVT_SESSION_CREATED()- Returns:
- Returns the counterSend_EVT_SESSION_CREATED.
-
getCounterSend_EVT_SESSION_DELTA
public long getCounterSend_EVT_SESSION_DELTA()- Returns:
- Returns the counterSend_EVT_SESSION_DELTA.
-
getCounterSend_EVT_SESSION_EXPIRED
public long getCounterSend_EVT_SESSION_EXPIRED()- Returns:
- Returns the counterSend_EVT_SESSION_EXPIRED.
-
getCounterSend_EVT_ALL_SESSION_DATA
public long getCounterSend_EVT_ALL_SESSION_DATA()- Returns:
- Returns the counterSend_EVT_ALL_SESSION_DATA.
-
getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE
public int getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE()- Returns:
- Returns the counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE.
-
getCounterSend_EVT_CHANGE_SESSION_ID
public long getCounterSend_EVT_CHANGE_SESSION_ID()- Returns:
- Returns the counterSend_EVT_CHANGE_SESSION_ID.
-
getCounterReceive_EVT_ALL_SESSION_DATA
public long getCounterReceive_EVT_ALL_SESSION_DATA()- Returns:
- Returns the counterReceive_EVT_ALL_SESSION_DATA.
-
getCounterReceive_EVT_GET_ALL_SESSIONS
public long getCounterReceive_EVT_GET_ALL_SESSIONS()- Returns:
- Returns the counterReceive_EVT_GET_ALL_SESSIONS.
-
getCounterReceive_EVT_SESSION_ACCESSED
public long getCounterReceive_EVT_SESSION_ACCESSED()- Returns:
- Returns the counterReceive_EVT_SESSION_ACCESSED.
-
getCounterReceive_EVT_SESSION_CREATED
public long getCounterReceive_EVT_SESSION_CREATED()- Returns:
- Returns the counterReceive_EVT_SESSION_CREATED.
-
getCounterReceive_EVT_SESSION_DELTA
public long getCounterReceive_EVT_SESSION_DELTA()- Returns:
- Returns the counterReceive_EVT_SESSION_DELTA.
-
getCounterReceive_EVT_SESSION_EXPIRED
public long getCounterReceive_EVT_SESSION_EXPIRED()- Returns:
- Returns the counterReceive_EVT_SESSION_EXPIRED.
-
getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE
public int getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE()- Returns:
- Returns the counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE.
-
getCounterReceive_EVT_CHANGE_SESSION_ID
public long getCounterReceive_EVT_CHANGE_SESSION_ID()- Returns:
- Returns the counterReceive_EVT_CHANGE_SESSION_ID.
-
getCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER
public long getCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER()- Returns:
- Returns the counterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER.
-
getSessionReplaceCounter
public long getSessionReplaceCounter()- Returns:
- Returns the sessionReplaceCounter.
-
getCounterNoStateTransfered
Deprecated.UsegetCounterNoStateTransferred()
. Will be removed in Tomcat 10 onwards.- Returns:
- Returns the counterNoStateTransferred.
-
getCounterNoStateTransferred
public int getCounterNoStateTransferred()- Returns:
- Returns the counterNoStateTransferred.
-
getReceivedQueueSize
public int getReceivedQueueSize() -
getStateTransferTimeout
public int getStateTransferTimeout()- Returns:
- Returns the stateTransferTimeout.
-
setStateTransferTimeout
public void setStateTransferTimeout(int timeoutAllSession) - Parameters:
timeoutAllSession
- The timeout
-
getStateTransfered
Deprecated.UsegetStateTransferred()
. Will be removed in Tomcat 10 onwards.- Returns:
true
if the state transfer is complete.
-
setStateTransfered
Deprecated.UsesetStateTransferred(boolean)
. Will be removed in Tomcat 10 onwards.Set that state transferred is complete- Parameters:
stateTransferred
- Flag value
-
getStateTransferred
public boolean getStateTransferred()- Returns:
true
if the state transfer is complete.
-
setStateTransferred
public void setStateTransferred(boolean stateTransferred) Set that state transferred is complete- Parameters:
stateTransferred
- Flag value
-
isNoContextManagerReceived
public boolean isNoContextManagerReceived() -
setNoContextManagerReceived
public void setNoContextManagerReceived(boolean noContextManagerReceived) -
getSendAllSessionsWaitTime
public int getSendAllSessionsWaitTime()- Returns:
- the sendAllSessionsWaitTime in msec
-
setSendAllSessionsWaitTime
public void setSendAllSessionsWaitTime(int sendAllSessionsWaitTime) - Parameters:
sendAllSessionsWaitTime
- The sendAllSessionsWaitTime to set at msec.
-
isStateTimestampDrop
public boolean isStateTimestampDrop()- Returns:
- the stateTimestampDrop.
-
setStateTimestampDrop
public void setStateTimestampDrop(boolean isTimestampDrop) - Parameters:
isTimestampDrop
- The new flag value
-
isSendAllSessions
public boolean isSendAllSessions()- Returns:
- the sendAllSessions.
-
setSendAllSessions
public void setSendAllSessions(boolean sendAllSessions) - Parameters:
sendAllSessions
- The sendAllSessions to set.
-
getSendAllSessionsSize
public int getSendAllSessionsSize()- Returns:
- the sendAllSessionsSize.
-
setSendAllSessionsSize
public void setSendAllSessionsSize(int sendAllSessionsSize) - Parameters:
sendAllSessionsSize
- The sendAllSessionsSize to set.
-
isNotifySessionListenersOnReplication
public boolean isNotifySessionListenersOnReplication()- Returns:
- the notifySessionListenersOnReplication.
-
setNotifySessionListenersOnReplication
public void setNotifySessionListenersOnReplication(boolean notifyListenersCreateSessionOnReplication) - Parameters:
notifyListenersCreateSessionOnReplication
- The notifySessionListenersOnReplication to set.
-
isExpireSessionsOnShutdown
public boolean isExpireSessionsOnShutdown() -
setExpireSessionsOnShutdown
public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown) -
isNotifyContainerListenersOnReplication
public boolean isNotifyContainerListenersOnReplication() -
setNotifyContainerListenersOnReplication
public void setNotifyContainerListenersOnReplication(boolean notifyContainerListenersOnReplication) -
createSession
Description copied from interface:Manager
Construct 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:
createSession
in interfaceManager
- Overrides:
createSession
in classManagerBase
- Parameters:
sessionId
- The session id which should be used to create the new session; ifnull
, 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
-
createSession
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 sessiondistribute
-true
to replicate the new session- Returns:
- The session
-
sendCreateSession
Send create session event to all backup node- Parameters:
sessionId
- The session id of the sessionsession
- The session object
-
send
Send messages to other backup member (domain or all)- Parameters:
msg
- Session message
-
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:
createEmptySession
in interfaceManager
- Overrides:
createEmptySession
in classManagerBase
- Returns:
- An empty Session object
-
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
-
changeSessionId
Description copied from interface:Manager
Change the session ID of the current session to a new randomly generated session ID.- Specified by:
changeSessionId
in interfaceManager
- Overrides:
changeSessionId
in classManagerBase
- Parameters:
session
- The session to change the session ID for
-
rotateSessionId
Description copied from interface:Manager
Change the session ID of the current session to a new randomly generated session ID.- Specified by:
rotateSessionId
in interfaceManager
- Overrides:
rotateSessionId
in classManagerBase
- Parameters:
session
- The session to change the session ID for- Returns:
- The new session ID
-
changeSessionId
Description copied from interface:Manager
Change the session ID of the current session to a specified session ID.- Specified by:
changeSessionId
in interfaceManager
- Overrides:
changeSessionId
in classManagerBase
- Parameters:
session
- The session to change the session ID fornewId
- new session ID
-
changeSessionId
Deprecated.Will be removed in Tomcat 10- Parameters:
session
- The sessionnotify
- Notify change
-
rotateSessionId
-
changeSessionId
-
sendChangeSessionId
-
serializeSessionId
serialize sessionID- Parameters:
sessionId
- Session id to serialize- Returns:
- byte array with serialized session id
- Throws:
IOException
- if an input/output error occurs
-
deserializeSessionId
Load sessionID- Parameters:
data
- serialized session id- Returns:
- session id
- Throws:
IOException
- if an input/output error occurs
-
deserializeDeltaRequest
@Deprecated protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data) throws ClassNotFoundException, 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 sessiondata
- message data- Returns:
- The request
- Throws:
ClassNotFoundException
- Serialization errorIOException
- IO error with serialization- See Also:
-
serializeDeltaRequest
@Deprecated protected byte[] serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest) throws 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 sessiondeltaRequest
- The request to serialize- Returns:
- serialized delta request
- Throws:
IOException
- IO error with serialization- See Also:
-
deserializeSessions
Load 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:
ClassNotFoundException
- if a serialized class cannot be found during the reloadIOException
- if an input/output error occurs
-
serializeSessions
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:
IOException
- if an input/output error occurs
-
startInternal
Start this component and implement the requirements ofLifecycleBase.startInternal()
.- Overrides:
startInternal
in classClusterManagerBase
- Throws:
LifecycleException
- if this component detects a fatal error that prevents this component from being used
-
getAllClusterSessions
public void getAllClusterSessions()get from first session master the backup from all clustered sessions- See Also:
-
findSessionMasterMember
Find the master of the session state- Returns:
- master member of sessions
-
waitForSendAllSessions
protected 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
-
stopInternal
Stop this component and implement the requirements ofLifecycleBase.stopInternal()
.- Overrides:
stopInternal
in classClusterManagerBase
- Throws:
LifecycleException
- if this component detects a fatal error that prevents this component from being used
-
messageDataReceived
Description copied from interface:ClusterManager
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.
-
requestCompleted
Description copied from interface:ClusterManager
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.
-
requestCompleted
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,
-
resetStatistics
public void resetStatistics()Reset manager statistics -
sessionExpired
send session expired to other cluster nodes- Parameters:
id
- session id
-
expireAllLocalSessions
public void expireAllLocalSessions()Expire all find sessions. -
getInvalidatedSessions
Description copied from interface:ClusterManager
When 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
-
messageReceived
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 receivedsender
- - 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_TRANSFERCOMPLETE
handle receive session state is complete transferred- Parameters:
msg
- Session messagesender
- Member which sent the message
-
handleSESSION_DELTA
protected void handleSESSION_DELTA(SessionMessage msg, Member sender) throws IOException, ClassNotFoundException handle receive session delta- Parameters:
msg
- Session messagesender
- Member which sent the message- Throws:
IOException
- IO error with serializationClassNotFoundException
- Serialization error
-
handleSESSION_ACCESSED
handle receive session is access at other node ( primary session is now false)- Parameters:
msg
- Session messagesender
- Member which sent the message- Throws:
IOException
- Propagated IO error
-
handleSESSION_EXPIRED
handle receive session is expire at other node ( expire session also here)- Parameters:
msg
- Session messagesender
- Member which sent the message- Throws:
IOException
- Propagated IO error
-
handleSESSION_CREATED
handle receive new session is created at other node (create backup - primary false)- Parameters:
msg
- Session messagesender
- Member which sent the message
-
handleALL_SESSION_DATA
protected void handleALL_SESSION_DATA(SessionMessage msg, Member sender) throws ClassNotFoundException, IOException handle receive sessions from other not ( restart )- Parameters:
msg
- Session messagesender
- Member which sent the message- Throws:
ClassNotFoundException
- Serialization errorIOException
- IO error with serialization
-
handleGET_ALL_SESSIONS
Handle a get all sessions message from another node. Depending onsendAllSessions
, sessions are either sent in a single message or in batches. Sending is complete when this method exits.- Parameters:
msg
- Session messagesender
- Member which sent the message- Throws:
IOException
- IO error sending messages
-
handleCHANGE_SESSION_ID
handle receive change sessionID at other node- Parameters:
msg
- Session messagesender
- Member which sent the message- Throws:
IOException
- IO error with serialization
-
handleALL_SESSION_NOCONTEXTMANAGER
handle receive no context manager.- Parameters:
msg
- Session messagesender
- Member which sent the message
-
sendSessions
protected void sendSessions(Member sender, Session[] currentSessions, long sendTimestamp) throws IOException send a block of session to sender- Parameters:
sender
- Sender membercurrentSessions
- Sessions to sendsendTimestamp
- Timestamp- Throws:
IOException
- IO error sending messages
-
cloneFromTemplate
- Returns:
- a clone of a template manager configuration
-