Apache Tomcat 7.0.4

org.apache.catalina.ha.session
Class BackupManager

java.lang.Object
  extended by org.apache.catalina.util.LifecycleBase
      extended by org.apache.catalina.util.LifecycleMBeanBase
          extended by org.apache.catalina.session.ManagerBase
              extended by org.apache.catalina.ha.session.ClusterManagerBase
                  extended by org.apache.catalina.ha.session.BackupManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, MBeanRegistration, ClusterManager, Lifecycle, Manager, AbstractReplicatedMap.MapOwner

public class BackupManager
extends ClusterManagerBase
implements AbstractReplicatedMap.MapOwner

Version:
1.0
Author:
Filip Hanik

Field Summary
protected  CatalinaCluster cluster
          A reference to the cluster
protected static long DEFAULT_REPL_TIMEOUT
           
protected  boolean mExpireSessionsOnShutdown
          Set to true if we don't want the sessions to expire on shutdown
protected  String name
          The name of this manager
 
Fields inherited from class org.apache.catalina.session.ManagerBase
algorithm, container, DEFAULT_ALGORITHM, devRandomSource, digest, distributable, duplicates, entropy, expiredSessions, maxActive, maxActiveSessions, maxInactiveInterval, processExpiresFrequency, processingTime, random, randomClass, randomIS, rejectedSessions, sessionAverageAliveTime, sessionCounter, sessionIdLength, sessionMaxAliveTime, sessions, sm, support
 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserver
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, DESTROY_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.
 int getActiveSessionsFull()
           
 CatalinaCluster getCluster()
           
 boolean getExpireSessionsOnShutdown()
           
 String[] getInvalidatedSessions()
          When the manager expires session not tied to a request.
 String getMapName()
           
 int getMapSendOptions()
           
 String getName()
          Return the descriptive short name of this Manager implementation.
 Set<String> getSessionIdsFull()
           
 boolean isNotifyListenersOnReplication()
           
 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(Object key, Object value)
           
 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.
 void setCluster(CatalinaCluster cluster)
           
 void setDistributable(boolean dist)
          Set the distributable flag for the sessions supported by this Manager.
 void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)
           
 void setMapSendOptions(int mapSendOptions)
           
 void setName(String name)
          Set the name of the manager, at host /context name and at engine hostname+/context
 void setNotifyListenersOnReplication(boolean notifyListenersOnReplication)
           
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().
 
Methods inherited from class org.apache.catalina.ha.session.ClusterManagerBase
getClassLoaders, getClassLoaders, getReplicationStream, getReplicationStream, load, unload
 
Methods inherited from class org.apache.catalina.session.ManagerBase
add, addPropertyChangeListener, backgroundProcess, changeSessionId, createSession, destroyInternal, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getAlgorithm, getClassName, getContainer, getCreationTime, getCreationTimestamp, getDigest, getDistributable, getDomainInternal, getDuplicates, getEngine, getEntropy, getExpiredSessions, getInfo, getJvmRoute, getLastAccessedTime, getLastAccessedTimestamp, getMaxActive, getMaxActiveSessions, getMaxInactiveInterval, getNewSession, getObjectNameKeyProperties, getProcessExpiresFrequency, getProcessingTime, getRandom, getRandomBytes, getRandomClass, getRandomFile, getRejectedSessions, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, getThisAccessedTime, getThisAccessedTimestamp, initInternal, listSessionIds, processExpires, propertyChange, remove, removePropertyChangeListener, setAlgorithm, setContainer, setDuplicates, setEntropy, setExpiredSessions, setMaxActive, setMaxActiveSessions, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setRandomClass, setRandomFile, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, toString
 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
 
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, 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, changeSessionId, createSession, findSession, findSessions, getActiveSessions, getContainer, getDistributable, getExpiredSessions, getInfo, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, remove, removePropertyChangeListener, setContainer, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime
 

Field Detail

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 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.

setExpireSessionsOnShutdown

public void setExpireSessionsOnShutdown(boolean expireSessionsOnShutdown)

setCluster

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

getExpireSessionsOnShutdown

public boolean getExpireSessionsOnShutdown()

requestCompleted

public ClusterMessage requestCompleted(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(Object key,
                             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

getName

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

Specified by:
getName in interface ClusterManager
Overrides:
getName in class ManagerBase
Returns:
String

startInternal

protected void startInternal()
                      throws LifecycleException
Start this component and implement the requirements of LifecycleBase.startInternal(). 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:
startInternal in class LifecycleBase
Throws:
LifecycleException - if this component detects a fatal error that prevents this component from being used

getMapName

public String getMapName()

stopInternal

protected void stopInternal()
                     throws LifecycleException
Stop this component and implement the requirements of LifecycleBase.stopInternal(). This will disconnect the cluster communication channel and stop the listener thread.

Specified by:
stopInternal in class LifecycleBase
Throws:
LifecycleException - if this component detects a fatal error that prevents this component from being used

setDistributable

public void setDistributable(boolean dist)
Description copied from class: ManagerBase
Set the distributable flag for the sessions supported by this Manager. If this flag is set, all user data objects added to sessions associated with this manager must implement Serializable.

Specified by:
setDistributable in interface Manager
Overrides:
setDistributable in class ManagerBase
Parameters:
dist - The new distributable flag

setName

public void setName(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()

getInvalidatedSessions

public 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 String listSessionIdsFull()

getSessionIdsFull

public Set<String> getSessionIdsFull()

Apache Tomcat 7.0.4

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