public class DeltaManager extends ClusterManagerBase
start() and
stop() methods of this class at the correct times.ManagerBase.SessionTimingLifecycle.SingleUse| Modifier and Type | Field and Description |
|---|---|
Log |
log |
protected static String |
managerName
Deprecated.
Unused. Will be removed in Tomcat 9
|
protected String |
name |
protected static StringManager |
sm
The string manager for this package.
|
clusterduplicates, expiredSessions, maxActive, maxActiveSessions, processExpiresFrequency, processingTime, rejectedSessions, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdGenerator, sessionIdGeneratorClass, sessionMaxAliveTime, sessions, support, TIMING_STATS_CACHE_SIZEmserverAFTER_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 and Description |
|---|
DeltaManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
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) |
void |
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) |
ClusterManager |
cloneFromTemplate() |
Session |
createEmptySession()
Get a session from the recycled ones or create a new empty one.
|
Session |
createSession(String sessionId)
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
Session |
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. 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=62841
|
protected String |
deserializeSessionId(byte[] data)
Load sessionID
|
protected void |
deserializeSessions(byte[] data)
Load sessions from other cluster node.
|
void |
expireAllLocalSessions()
Expire all find sessions.
|
protected Member |
findSessionMasterMember()
Find the master of the session state
|
void |
getAllClusterSessions()
get from first session master the backup from all clustered sessions
|
int |
getCounterNoStateTransfered() |
long |
getCounterReceive_EVT_ALL_SESSION_DATA() |
long |
getCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER() |
int |
getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE() |
long |
getCounterReceive_EVT_CHANGE_SESSION_ID() |
long |
getCounterReceive_EVT_GET_ALL_SESSIONS() |
long |
getCounterReceive_EVT_SESSION_ACCESSED() |
long |
getCounterReceive_EVT_SESSION_CREATED() |
long |
getCounterReceive_EVT_SESSION_DELTA() |
long |
getCounterReceive_EVT_SESSION_EXPIRED() |
long |
getCounterSend_EVT_ALL_SESSION_DATA() |
int |
getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE() |
long |
getCounterSend_EVT_CHANGE_SESSION_ID() |
long |
getCounterSend_EVT_GET_ALL_SESSIONS() |
long |
getCounterSend_EVT_SESSION_ACCESSED() |
long |
getCounterSend_EVT_SESSION_CREATED() |
long |
getCounterSend_EVT_SESSION_DELTA() |
long |
getCounterSend_EVT_SESSION_EXPIRED() |
String[] |
getInvalidatedSessions()
When the manager expires session not tied to a request.
|
String |
getName()
Return the name of the manager, at host /context name and at engine hostname+/context.
|
protected DeltaSession |
getNewDeltaSession()
Deprecated.
Unused. This will be removed in Tomcat 10.
|
long |
getProcessingTime() |
int |
getReceivedQueueSize() |
int |
getSendAllSessionsSize() |
int |
getSendAllSessionsWaitTime() |
long |
getSessionReplaceCounter() |
boolean |
getStateTransfered() |
int |
getStateTransferTimeout() |
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 transferred
|
protected void |
handleCHANGE_SESSION_ID(SessionMessage msg,
Member sender)
handle receive change sessionID at other node
|
protected void |
handleGET_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 transferred
|
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 delta
|
protected void |
handleSESSION_EXPIRED(SessionMessage msg,
Member sender)
handle receive session is expire at other node ( expire session also here)
|
boolean |
isExpireSessionsOnShutdown() |
boolean |
isNoContextManagerReceived() |
boolean |
isNotifyContainerListenersOnReplication() |
boolean |
isNotifySessionListenersOnReplication() |
boolean |
isSendAllSessions() |
boolean |
isStateTimestampDrop() |
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.
|
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.
|
ClusterMessage |
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.
|
ClusterMessage |
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 |
resetStatistics()
Reset manager statistics
|
String |
rotateSessionId(Session session) |
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 node
|
protected void |
sendSessions(Member sender,
Session[] currentSessions,
long sendTimestamp)
send a block of session to sender
|
protected byte[] |
serializeDeltaRequest(DeltaSession session,
DeltaRequest deltaRequest)
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=62841
|
protected byte[] |
serializeSessionId(String sessionId)
serialize sessionID
|
protected 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 nodes
|
void |
setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown) |
void |
setName(String name)
Set the name of the manager, at host /context name and at engine hostname+/context
|
void |
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 stateTransfered)
Set that state transferred is complete
|
void |
setStateTransferTimeout(int timeoutAllSession) |
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(). |
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)
|
clone, getClassLoaders, getClassLoaders, getCluster, getDeltaRequestPool, getReplicationStream, getReplicationStream, isNotifyListenersOnReplication, isRecordAllActions, load, registerSessionAtReplicationValve, setCluster, setNotifyListenersOnReplication, setRecordAllActions, unloadadd, addPropertyChangeListener, backgroundProcess, changeSessionId, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getClassName, getContext, getCreationTime, getCreationTimestamp, getDomainInternal, getDuplicates, getEngine, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getNewSession, getObjectNameKeyProperties, getPersistAuthentication, 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, setProcessExpiresFrequency, setProcessingTime, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSessionAttributeNameFilter, setSessionAttributeValueClassNameFilter, setSessionCounter, setSessionIdGenerator, setSessionMaxAliveTime, setWarnOnSessionAttributeFilterFailure, toString, updateSessionMaxAliveTime, willAttributeDistributedestroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregisteraddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, addPropertyChangeListener, backgroundProcess, findSession, findSessions, getActiveSessions, getContext, getExpiredSessions, getMaxActive, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdGenerator, getSessionMaxAliveTime, remove, remove, removePropertyChangeListener, setContext, setExpiredSessions, setMaxActive, setSessionCounter, setSessionIdGenerator, setSessionMaxAliveTime, willAttributeDistributepublic final Log log
protected static final StringManager sm
@Deprecated protected static final String managerName
protected String name
public void setName(String name)
ClusterManagername - The manager namepublic String getName()
ClusterManagergetName in interface ClusterManagergetName in class ManagerBasepublic long getCounterSend_EVT_GET_ALL_SESSIONS()
public long getCounterSend_EVT_SESSION_ACCESSED()
public long getCounterSend_EVT_SESSION_CREATED()
public long getCounterSend_EVT_SESSION_DELTA()
public long getCounterSend_EVT_SESSION_EXPIRED()
public long getCounterSend_EVT_ALL_SESSION_DATA()
public int getCounterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE()
public long getCounterSend_EVT_CHANGE_SESSION_ID()
public long getCounterReceive_EVT_ALL_SESSION_DATA()
public long getCounterReceive_EVT_GET_ALL_SESSIONS()
public long getCounterReceive_EVT_SESSION_ACCESSED()
public long getCounterReceive_EVT_SESSION_CREATED()
public long getCounterReceive_EVT_SESSION_DELTA()
public long getCounterReceive_EVT_SESSION_EXPIRED()
public int getCounterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE()
public long getCounterReceive_EVT_CHANGE_SESSION_ID()
public long getCounterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER()
public long getProcessingTime()
getProcessingTime in class ManagerBasepublic long getSessionReplaceCounter()
public int getCounterNoStateTransfered()
public int getReceivedQueueSize()
public int getStateTransferTimeout()
public void setStateTransferTimeout(int timeoutAllSession)
timeoutAllSession - The timeoutpublic boolean getStateTransfered()
true if the state transfer is complete.public void setStateTransfered(boolean stateTransfered)
stateTransfered - Flag valuepublic boolean isNoContextManagerReceived()
public void setNoContextManagerReceived(boolean noContextManagerReceived)
public int getSendAllSessionsWaitTime()
public void setSendAllSessionsWaitTime(int sendAllSessionsWaitTime)
sendAllSessionsWaitTime - The sendAllSessionsWaitTime to set at msec.public boolean isStateTimestampDrop()
public void setStateTimestampDrop(boolean isTimestampDrop)
isTimestampDrop - The new flag valuepublic boolean isSendAllSessions()
public void setSendAllSessions(boolean sendAllSessions)
sendAllSessions - The sendAllSessions to set.public int getSendAllSessionsSize()
public void setSendAllSessionsSize(int sendAllSessionsSize)
sendAllSessionsSize - The sendAllSessionsSize to set.public boolean isNotifySessionListenersOnReplication()
public void setNotifySessionListenersOnReplication(boolean notifyListenersCreateSessionOnReplication)
notifyListenersCreateSessionOnReplication - The notifySessionListenersOnReplication to set.public boolean isExpireSessionsOnShutdown()
public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
public boolean isNotifyContainerListenersOnReplication()
public void setNotifyContainerListenersOnReplication(boolean notifyContainerListenersOnReplication)
public Session createSession(String sessionId)
Managernull.createSession in interface ManagercreateSession in class ManagerBasesessionId - 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.public Session createSession(String sessionId, boolean distribute)
sessionId - The session id that should be used for the sessiondistribute - true to replicate the new sessionprotected void sendCreateSession(String sessionId, DeltaSession session)
sessionId - The session id of the sessionsession - The session objectprotected void send(SessionMessage msg)
msg - Session messagepublic Session createEmptySession()
Creates new DeltaSession instance.
createEmptySession in interface ManagercreateEmptySession in class ManagerBase@Deprecated protected DeltaSession getNewDeltaSession()
public void changeSessionId(Session session)
ManagerchangeSessionId in interface ManagerchangeSessionId in class ManagerBasesession - The session to change the session ID forpublic String rotateSessionId(Session session)
rotateSessionId in class ManagerBasepublic void changeSessionId(Session session, String newId)
ManagerchangeSessionId in interface ManagerchangeSessionId in class ManagerBasesession - The session to change the session ID fornewId - new session IDprotected void changeSessionId(Session session, boolean notify)
protected byte[] serializeSessionId(String sessionId) throws IOException
sessionId - Session id to serializeIOException - if an input/output error occursprotected String deserializeSessionId(byte[] data) throws IOException
data - serialized session idIOException - if an input/output error occurs@Deprecated protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data) throws ClassNotFoundException, IOException
session - Corresponding sessiondata - message dataClassNotFoundException - Serialization errorIOException - IO error with serializationDeltaRequest.readExternal(java.io.ObjectInput)@Deprecated protected byte[] serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest) throws IOException
session - Associated sessiondeltaRequest - The request to serializeIOException - IO error with serializationDeltaRequest.writeExternal(java.io.ObjectOutput)protected void deserializeSessions(byte[] data)
throws ClassNotFoundException,
IOException
data - Serialized dataClassNotFoundException - if a serialized class cannot be found during the reloadIOException - if an input/output error occursprotected byte[] serializeSessions(Session[] currentSessions) throws IOException
currentSessions - Sessions to serializeIOException - if an input/output error occursprotected void startInternal()
throws LifecycleException
LifecycleBase.startInternal().startInternal in class ClusterManagerBaseLifecycleException - if this component detects a fatal error
that prevents this component from being usedpublic void getAllClusterSessions()
findSessionMasterMember()protected Member findSessionMasterMember()
protected void waitForSendAllSessions(long beforeSendTime)
beforeSendTime - Start instant of the operationprotected void stopInternal()
throws LifecycleException
LifecycleBase.stopInternal().stopInternal in class ClusterManagerBaseLifecycleException - if this component detects a fatal error
that prevents this component from being usedpublic void messageDataReceived(ClusterMessage cmsg)
cmsg - -
the message received.public ClusterMessage requestCompleted(String sessionId)
sessionId - -
the sessionId that just completed.public ClusterMessage requestCompleted(String sessionId, boolean expires)
sessionId - -
the sessionId that just completed.expires - -
whether this method has been called during session expirationpublic void resetStatistics()
protected void sessionExpired(String id)
id - session idpublic void expireAllLocalSessions()
public String[] getInvalidatedSessions()
ClusterManagerprotected void messageReceived(SessionMessage msg, Member sender)
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 nodeprotected void handleALL_SESSION_TRANSFERCOMPLETE(SessionMessage msg, Member sender)
msg - Session messagesender - Member which sent the messageprotected void handleSESSION_DELTA(SessionMessage msg, Member sender) throws IOException, ClassNotFoundException
msg - Session messagesender - Member which sent the messageIOException - IO error with serializationClassNotFoundException - Serialization errorprotected void handleSESSION_ACCESSED(SessionMessage msg, Member sender) throws IOException
msg - Session messagesender - Member which sent the messageIOException - Propagated IO errorprotected void handleSESSION_EXPIRED(SessionMessage msg, Member sender) throws IOException
msg - Session messagesender - Member which sent the messageIOException - Propagated IO errorprotected void handleSESSION_CREATED(SessionMessage msg, Member sender)
msg - Session messagesender - Member which sent the messageprotected void handleALL_SESSION_DATA(SessionMessage msg, Member sender) throws ClassNotFoundException, IOException
msg - Session messagesender - Member which sent the messageClassNotFoundException - Serialization errorIOException - IO error with serializationprotected void handleGET_ALL_SESSIONS(SessionMessage msg, Member sender) throws IOException
msg - Session messagesender - Member which sent the messageIOException - IO error sending messagesprotected void handleCHANGE_SESSION_ID(SessionMessage msg, Member sender) throws IOException
msg - Session messagesender - Member which sent the messageIOException - IO error with serializationprotected void handleALL_SESSION_NOCONTEXTMANAGER(SessionMessage msg, Member sender)
msg - Session messagesender - Member which sent the messageprotected void sendSessions(Member sender, Session[] currentSessions, long sendTimestamp) throws IOException
sender - Sender membercurrentSessions - Sessions to sendsendTimestamp - TimestampIOException - IO error sending messagespublic ClusterManager cloneFromTemplate()
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.