org.apache.catalina.ha.session
public class SimpleTcpReplicationManager extends StandardManager implements ClusterManager
ManagerBase.SessionTiming| Modifier and Type | Field and Description |
|---|---|
protected CatalinaCluster |
cluster |
protected boolean |
defaultMode |
protected boolean |
distributable |
protected java.util.HashMap |
invalidatedSessions |
static Log |
log |
protected java.lang.String |
mChannelConfig |
protected boolean |
mChannelStarted |
protected boolean |
mExpireSessionsOnShutdown
Set to true if we don't want the sessions to expire on shutdown
|
protected java.lang.String |
mGroupName |
protected boolean |
mManagerRunning |
protected boolean |
mPrintToScreen |
protected java.lang.String |
name |
protected boolean |
stateTransferred
Flag to keep track if the state has been transferred or not
Assumes false.
|
protected boolean |
synchronousReplication
Use synchronous rather than asynchronous replication.
|
protected boolean |
useDirtyFlag |
info, lifecycle, maxActiveSessions, pathname, processingTime, rejectedSessions, startedalgorithm, container, DEFAULT_ALGORITHM, devRandomSource, digest, domain, duplicates, entropy, expiredSessions, initialized, maxActive, maxInactiveInterval, mserver, oname, processExpiresFrequency, random, randomClass, randomIS, sessionAverageAliveTime, sessionCounter, sessionCreationTiming, sessionExpirationTiming, sessionIdLength, sessionMaxAliveTime, sessions, sm, support, TIMING_STATS_CACHE_SIZEAFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT| Constructor and Description |
|---|
SimpleTcpReplicationManager()
Constructor, just calls super()
|
| Modifier and Type | Method and Description |
|---|---|
ClusterManager |
cloneFromTemplate() |
Session |
createSession(java.lang.String sessionId)
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
protected Session |
createSession(java.lang.String sessionId,
boolean notify,
boolean setId)
Creates a HTTP session.
|
boolean |
doDomainReplication() |
CatalinaCluster |
getCluster() |
boolean |
getDistributable()
Return the distributable flag for the sessions supported by
this Manager.
|
boolean |
getExpireSessionsOnShutdown() |
java.lang.String[] |
getInvalidatedSessions()
When the manager expires session not tied to a request.
|
java.lang.String |
getName()
Return the descriptive short name of this Manager implementation.
|
ReplicationStream |
getReplicationStream(byte[] data)
Open Stream and use correct ClassLoader (Container) Switch
ThreadClassLoader
|
ReplicationStream |
getReplicationStream(byte[] data,
int offset,
int length) |
boolean |
isDefaultMode() |
boolean |
isManagerRunning() |
boolean |
isNotifyListenersOnReplication() |
boolean |
isStateTransferred() |
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.
|
protected Session |
readSession(byte[] data,
java.lang.String sessionId)
Reinstantiates a serialized session from the data passed in.
|
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.
|
void |
sessionInvalidated(java.lang.String sessionId) |
void |
setCluster(CatalinaCluster cluster) |
void |
setDefaultMode(boolean defaultMode) |
void |
setDistributable(boolean dist)
Set the distributable flag for the sessions supported by this
Manager.
|
void |
setDomainReplication(boolean sendClusterDomainOnly) |
void |
setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown) |
void |
setName(java.lang.String name)
Set the name of the manager, at host /context name and at engine hostname+/context
|
void |
setNotifyListenersOnReplication(boolean notifyListenersOnReplication) |
void |
setPrintToScreen(boolean printtoscreen) |
void |
setSynchronousReplication(boolean flag) |
void |
setUseDirtyFlag(boolean usedirtyflag) |
void |
start()
Prepare for the beginning of active use of the public methods of this
component.
|
void |
stop()
Gracefully terminate the active use of the public methods of this
component.
|
void |
unload()
Override persistence since they don't go hand in hand with replication for now.
|
protected byte[] |
writeSession(Session session)
Serialize a session into a byte array
This method simple calls the writeObjectData method on the session and returns the byte data from that call |
addLifecycleListener, doLoad, doUnload, file, findLifecycleListeners, getInfo, getMaxActiveSessions, getPathname, getRejectedSessions, load, propertyChange, removeLifecycleListener, setContainer, setMaxActiveSessions, setPathname, setRejectedSessionsadd, addPropertyChangeListener, backgroundProcess, changeSessionId, createEmptySession, createSession, destroy, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getAlgorithm, getClassName, getContainer, getCreationTime, getCreationTimestamp, getDigest, getDomain, getDuplicates, getEngine, getEntropy, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxInactiveInterval, getNewSession, getObjectName, getProcessExpiresFrequency, getProcessingTime, getRandom, getRandomBytes, getRandomClass, getRandomFile, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdLength, getSessionMaxAliveTime, init, listSessionIds, postDeregister, postRegister, preDeregister, preRegister, processExpires, remove, removePropertyChangeListener, setAlgorithm, setDuplicates, setEntropy, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setRandomClass, setRandomFile, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTimeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, addPropertyChangeListener, backgroundProcess, changeSessionId, createEmptySession, createSession, findSession, findSessions, getActiveSessions, getContainer, getExpiredSessions, getInfo, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, load, remove, removePropertyChangeListener, setContainer, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setRejectedSessions, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTimepublic static Log log
protected java.lang.String mChannelConfig
protected java.lang.String mGroupName
protected boolean mChannelStarted
protected boolean mPrintToScreen
protected boolean defaultMode
protected boolean mManagerRunning
protected boolean synchronousReplication
protected boolean mExpireSessionsOnShutdown
protected boolean useDirtyFlag
protected java.lang.String name
protected boolean distributable
protected CatalinaCluster cluster
protected java.util.HashMap invalidatedSessions
protected boolean stateTransferred
public SimpleTcpReplicationManager()
public boolean doDomainReplication()
doDomainReplication in interface ClusterManagerpublic void setDomainReplication(boolean sendClusterDomainOnly)
setDomainReplication in interface ClusterManagersendClusterDomainOnly - The sendClusterDomainOnly to set.public boolean isDefaultMode()
isDefaultMode in interface ClusterManagerpublic void setDefaultMode(boolean defaultMode)
setDefaultMode in interface ClusterManagerdefaultMode - The defaultMode to set.public boolean isManagerRunning()
public void setUseDirtyFlag(boolean usedirtyflag)
public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
public void setCluster(CatalinaCluster cluster)
setCluster in interface ClusterManagerpublic boolean getExpireSessionsOnShutdown()
public void setPrintToScreen(boolean printtoscreen)
public void setSynchronousReplication(boolean flag)
public void unload()
throws java.io.IOException
unload in interface Managerunload in class StandardManagerjava.io.IOException - if an input/output error occursprotected Session createSession(java.lang.String sessionId, boolean notify, boolean setId)
notify - - if set to true the other nodes in the cluster will be notified.
This flag is needed so that we can create a session before we deserialize
a replicated oneReplicatedSessionpublic Session createSession(java.lang.String sessionId)
null.createSession in interface ManagercreateSession in class StandardManagersessionId - The session id which should be used to create the
new session; if null, a new session id will be
generatedjava.lang.IllegalStateException - if a new session cannot be
instantiated for any reasonpublic void sessionInvalidated(java.lang.String sessionId)
public java.lang.String[] getInvalidatedSessions()
ClusterManagergetInvalidatedSessions in interface ClusterManagerpublic ClusterMessage requestCompleted(java.lang.String sessionId)
ClusterManagerrequestCompleted in interface ClusterManagersessionId - - the sessionId that just completed.protected byte[] writeSession(Session session)
session - - the session to be serializedpublic ReplicationStream getReplicationStream(byte[] data) throws java.io.IOException
getReplicationStream in interface ClusterManagerdata - java.io.IOExceptionpublic ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws java.io.IOException
getReplicationStream in interface ClusterManagerjava.io.IOExceptionprotected Session readSession(byte[] data, java.lang.String sessionId)
data - - a byte array containing session datapublic java.lang.String getName()
StandardManagergetName in interface ClusterManagergetName in class StandardManagerpublic void start()
throws LifecycleException
configure(),
and before any of the public methods of the component are utilized.start in interface Lifecyclestart in class StandardManagerjava.lang.IllegalStateException - if this component has already been
startedLifecycleException - if this component detects a fatal error
that prevents this component from being usedpublic void stop()
throws LifecycleException
stop in interface Lifecyclestop in class StandardManagerjava.lang.IllegalStateException - if this component has not been startedLifecycleException - if this component detects a fatal error
that needs to be reportedpublic void setDistributable(boolean dist)
ManagerBasesetDistributable in interface ManagersetDistributable in class ManagerBasedist - The new distributable flagpublic boolean getDistributable()
ManagerBasegetDistributable in interface ManagergetDistributable in class ManagerBaseprotected 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 nodepublic void messageDataReceived(ClusterMessage cmsg)
ClusterManagermessageDataReceived in interface ClusterManagercmsg - - the message received.public boolean isStateTransferred()
public void setName(java.lang.String name)
ClusterManagersetName in interface ClusterManagerpublic boolean isNotifyListenersOnReplication()
isNotifyListenersOnReplication in interface ClusterManagerpublic void setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
public CatalinaCluster getCluster()
getCluster in interface ClusterManagerpublic ClusterManager cloneFromTemplate()
cloneFromTemplate in interface ClusterManagerCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.