Apache Tomcat 6.0.53

org.apache.catalina.ha.session
Class BackupManager

java.lang.Object
  extended by org.apache.catalina.session.ManagerBase
      extended by org.apache.catalina.session.StandardManager
          extended by org.apache.catalina.ha.session.BackupManager
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, javax.management.MBeanRegistration, ClusterManager, Lifecycle, Manager, AbstractReplicatedMap.MapOwner

public class BackupManager
extends StandardManager
implements ClusterManager, AbstractReplicatedMap.MapOwner

Version:
1.0
Author:
Filip Hanik

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.catalina.session.ManagerBase
ManagerBase.SessionTiming
 
Field Summary
protected  CatalinaCluster cluster
          A reference to the cluster
protected static long DEFAULT_REPL_TIMEOUT
           
static Log log
           
protected  boolean mExpireSessionsOnShutdown
          Set to true if we don't want the sessions to expire on shutdown
protected  java.lang.String name
          The name of this manager
 
Fields inherited from class org.apache.catalina.session.StandardManager
info, lifecycle, maxActiveSessions, pathname, processingTime, rejectedSessions, started
 
Fields inherited from class org.apache.catalina.session.ManagerBase
algorithm, container, DEFAULT_ALGORITHM, devRandomSource, digest, distributable, 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_SIZE
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
BackupManager()
          Constructor, just calls super()
 
Method Summary
 ClusterManager cloneFromTemplate()
           
 Session createEmptySession()
          Get a session from the recycled ones or create a new empty one.
 boolean doDomainReplication()
           
 int getActiveSessionsFull()
           
 java.lang.ClassLoader[] getClassLoaders()
           
 CatalinaCluster getCluster()
           
 boolean getExpireSessionsOnShutdown()
           
 java.lang.String[] getInvalidatedSessions()
          When the manager expires session not tied to a request.
 java.lang.String getMapName()
           
 int getMapSendOptions()
           
 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)
           
 long getRpcTimeout()
           
 boolean isDefaultMode()
           
 boolean isNotifyListenersOnReplication()
           
 java.lang.String listSessionIdsFull()
           
 void messageDataReceived(ClusterMessage msg)
          A message was received from another node, this is the callback method to implement if you are interested in receiving replication messages.
 void objectMadePrimay(java.lang.Object key, java.lang.Object value)
           
 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 setCluster(CatalinaCluster cluster)
           
 void setDefaultMode(boolean defaultMode)
           
 void setDomainReplication(boolean sendClusterDomainOnly)
           
 void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
           
 void setMapSendOptions(int mapSendOptions)
           
 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 setRpcTimeout(long rpcTimeout)
           
 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.
 
Methods inherited from class org.apache.catalina.session.StandardManager
addLifecycleListener, createSession, doLoad, doUnload, file, findLifecycleListeners, getInfo, getMaxActiveSessions, getPathname, getRejectedSessions, load, propertyChange, removeLifecycleListener, setContainer, setMaxActiveSessions, setPathname, setRejectedSessions
 
Methods inherited from class org.apache.catalina.session.ManagerBase
add, addPropertyChangeListener, backgroundProcess, changeSessionId, createSession, destroy, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getAlgorithm, getClassName, getContainer, getCreationTime, getCreationTimestamp, getDigest, getDistributable, getDomain, getDuplicates, getEngine, getEntropy, getExpiredSessions, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxInactiveInterval, getNewSession, getObjectName, getProcessExpiresFrequency, getProcessingTime, getRandom, getRandomBytes, getRandomClass, getRandomFile, getSession, getSessionAttribute, getSessionAttributeNameFilter, getSessionAttributeNamePattern, getSessionAttributeValueClassNameFilter, getSessionAttributeValueClassNamePattern, getSessionAverageAliveTime, getSessionCounter, getSessionCreateRate, getSessionExpireRate, getSessionIdLength, getSessionMaxAliveTime, getWarnOnSessionAttributeFilterFailure, init, listSessionIds, postDeregister, postRegister, preDeregister, preRegister, processExpires, remove, removePropertyChangeListener, setAlgorithm, setDistributable, setDuplicates, setEntropy, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setRandomClass, setRandomFile, setSessionAttributeNameFilter, setSessionAttributeValueClassNameFilter, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, setWarnOnSessionAttributeFilterFailure, willAttributeDistribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Manager
add, addPropertyChangeListener, backgroundProcess, changeSessionId, createSession, createSession, findSession, findSessions, getActiveSessions, getContainer, getDistributable, getExpiredSessions, getInfo, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, load, remove, removePropertyChangeListener, setContainer, setDistributable, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setRejectedSessions, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, willAttributeDistribute
 

Field Detail

log

public static Log log

DEFAULT_REPL_TIMEOUT

protected static long DEFAULT_REPL_TIMEOUT

mExpireSessionsOnShutdown

protected boolean mExpireSessionsOnShutdown
Set to true if we don't want the sessions to expire on shutdown


name

protected java.lang.String name
The name of this manager


cluster

protected CatalinaCluster cluster
A reference to the cluster

Constructor Detail

BackupManager

public BackupManager()
Constructor, just calls super()

Method Detail

messageDataReceived

public void messageDataReceived(ClusterMessage msg)
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.

Specified by:
messageDataReceived in interface ClusterManager
Parameters:
msg - - the message received.

doDomainReplication

public boolean doDomainReplication()
Specified by:
doDomainReplication in interface ClusterManager
Returns:
Manager send only to same cluster domain.

setDomainReplication

public void setDomainReplication(boolean sendClusterDomainOnly)
Specified by:
setDomainReplication in interface ClusterManager
Parameters:
sendClusterDomainOnly - The sendClusterDomainOnly to set.

isDefaultMode

public boolean isDefaultMode()
Specified by:
isDefaultMode in interface ClusterManager
Returns:
Returns the defaultMode.

setDefaultMode

public void setDefaultMode(boolean defaultMode)
Specified by:
setDefaultMode in interface ClusterManager
Parameters:
defaultMode - The defaultMode to set.

setExpireSessionsOnShutdown

public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)

setCluster

public void setCluster(CatalinaCluster cluster)
Specified by:
setCluster in interface ClusterManager

getExpireSessionsOnShutdown

public boolean getExpireSessionsOnShutdown()

unload

public void unload()
            throws java.io.IOException
Override persistence since they don't go hand in hand with replication for now.

Specified by:
unload in interface Manager
Overrides:
unload in class StandardManager
Throws:
java.io.IOException - if an input/output error occurs

requestCompleted

public ClusterMessage requestCompleted(java.lang.String sessionId)
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.

Specified by:
requestCompleted in interface ClusterManager
Parameters:
sessionId - - the sessionId that just completed.
Returns:
a SessionMessage to be sent.

objectMadePrimay

public void objectMadePrimay(java.lang.Object key,
                             java.lang.Object value)
Specified by:
objectMadePrimay in interface AbstractReplicatedMap.MapOwner

createEmptySession

public Session createEmptySession()
Description copied from class: ManagerBase
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.

Specified by:
createEmptySession in interface Manager
Overrides:
createEmptySession in class ManagerBase

getClassLoaders

public java.lang.ClassLoader[] getClassLoaders()

getReplicationStream

public ReplicationStream getReplicationStream(byte[] data)
                                       throws java.io.IOException
Open Stream and use correct ClassLoader (Container) Switch ThreadClassLoader

Specified by:
getReplicationStream in interface ClusterManager
Parameters:
data -
Returns:
The object input stream
Throws:
java.io.IOException

getReplicationStream

public ReplicationStream getReplicationStream(byte[] data,
                                              int offset,
                                              int length)
                                       throws java.io.IOException
Specified by:
getReplicationStream in interface ClusterManager
Throws:
java.io.IOException

getName

public java.lang.String getName()
Description copied from class: StandardManager
Return the descriptive short name of this Manager implementation.

Specified by:
getName in interface ClusterManager
Overrides:
getName in class StandardManager
Returns:
The descriptive short name of this Manager implementation.

start

public void start()
           throws LifecycleException
Prepare for the beginning of active use of the public methods of this component. This method should be called after configure(), and before any of the public methods of the component are utilized.
Starts the cluster communication channel, this will connect with the other nodes in the cluster, and request the current session state to be transferred to this node.

Specified by:
start in interface Lifecycle
Overrides:
start in class StandardManager
Throws:
java.lang.IllegalStateException - if this component has already been started
LifecycleException - if this component detects a fatal error that prevents this component from being used

getMapName

public java.lang.String getMapName()

stop

public void stop()
          throws LifecycleException
Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
This will disconnect the cluster communication channel and stop the listener thread.

Specified by:
stop in interface Lifecycle
Overrides:
stop in class StandardManager
Throws:
java.lang.IllegalStateException - if this component has not been started
LifecycleException - if this component detects a fatal error that needs to be reported

setName

public void setName(java.lang.String name)
Description copied from interface: ClusterManager
Set the name of the manager, at host /context name and at engine hostname+/context

Specified by:
setName in interface ClusterManager

isNotifyListenersOnReplication

public boolean isNotifyListenersOnReplication()
Specified by:
isNotifyListenersOnReplication in interface ClusterManager

setNotifyListenersOnReplication

public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication)

setMapSendOptions

public void setMapSendOptions(int mapSendOptions)

getCluster

public CatalinaCluster getCluster()
Specified by:
getCluster in interface ClusterManager

getMapSendOptions

public int getMapSendOptions()

setRpcTimeout

public void setRpcTimeout(long rpcTimeout)

getRpcTimeout

public long getRpcTimeout()

getInvalidatedSessions

public java.lang.String[] 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.

Specified by:
getInvalidatedSessions in interface ClusterManager
Returns:
String[] The invalidated sessions

cloneFromTemplate

public ClusterManager cloneFromTemplate()
Specified by:
cloneFromTemplate in interface ClusterManager

getActiveSessionsFull

public int getActiveSessionsFull()

listSessionIdsFull

public java.lang.String listSessionIdsFull()

Apache Tomcat 6.0.53

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.