From: rjung Date: Tue, 20 Sep 2011 11:32:49 +0000 (+0000) Subject: Pull up members "cluster" and "notifyListenersOnReplication" X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c79364adc1ceb1d69c27dd5f9c87144c180359e7;p=tomcat7.0 Pull up members "cluster" and "notifyListenersOnReplication" to common base class. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1173088 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/ha/session/BackupManager.java b/java/org/apache/catalina/ha/session/BackupManager.java index 2d0a53ab3..73e889aa5 100644 --- a/java/org/apache/catalina/ha/session/BackupManager.java +++ b/java/org/apache/catalina/ha/session/BackupManager.java @@ -24,7 +24,6 @@ import org.apache.catalina.DistributedManager; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.Session; -import org.apache.catalina.ha.CatalinaCluster; import org.apache.catalina.ha.ClusterManager; import org.apache.catalina.ha.ClusterMessage; import org.apache.catalina.tribes.Channel; @@ -53,15 +52,6 @@ public class BackupManager extends ClusterManagerBase protected String name; /** - * A reference to the cluster - */ - protected CatalinaCluster cluster; - - /** - * Should listeners be notified? - */ - private boolean notifyListenersOnReplication; - /** * */ private int mapSendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK; @@ -93,13 +83,6 @@ public class BackupManager extends ClusterManagerBase mExpireSessionsOnShutdown = expireSessionsOnShutdown; } - @Override - public void setCluster(CatalinaCluster cluster) { - if(log.isDebugEnabled()) - log.debug("Cluster associated with BackupManager"); - this.cluster = cluster; - } - public boolean getExpireSessionsOnShutdown() { return mExpireSessionsOnShutdown; @@ -160,9 +143,8 @@ public class BackupManager extends ClusterManagerBase try { cluster.registerManager(this); - CatalinaCluster catclust = cluster; LazyReplicatedMap map = new LazyReplicatedMap(this, - catclust.getChannel(), + cluster.getChannel(), rpcTimeout, getMapName(), getClassLoaders()); @@ -176,8 +158,7 @@ public class BackupManager extends ClusterManagerBase } public String getMapName() { - CatalinaCluster catclust = cluster; - String name = catclust.getManagerName(getName(),this)+"-"+"map"; + String name = cluster.getManagerName(getName(),this)+"-"+"map"; if ( log.isDebugEnabled() ) log.debug("Backup manager, Setting map name to:"+name); return name; } @@ -219,26 +200,11 @@ public class BackupManager extends ClusterManagerBase public void setName(String name) { this.name = name; } - @Override - public boolean isNotifyListenersOnReplication() { - return notifyListenersOnReplication; - } - public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication) { - this.notifyListenersOnReplication = notifyListenersOnReplication; - } public void setMapSendOptions(int mapSendOptions) { this.mapSendOptions = mapSendOptions; } - /* - * @see org.apache.catalina.ha.ClusterManager#getCluster() - */ - @Override - public CatalinaCluster getCluster() { - return cluster; - } - public int getMapSendOptions() { return mapSendOptions; } diff --git a/java/org/apache/catalina/ha/session/ClusterManagerBase.java b/java/org/apache/catalina/ha/session/ClusterManagerBase.java index 978ca229b..2829c3a09 100644 --- a/java/org/apache/catalina/ha/session/ClusterManagerBase.java +++ b/java/org/apache/catalina/ha/session/ClusterManagerBase.java @@ -23,6 +23,7 @@ import java.util.regex.Pattern; import org.apache.catalina.Container; import org.apache.catalina.Loader; +import org.apache.catalina.ha.CatalinaCluster; import org.apache.catalina.ha.ClusterManager; import org.apache.catalina.session.ManagerBase; import org.apache.catalina.tribes.io.ReplicationStream; @@ -37,6 +38,16 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterManager { /** + * A reference to the cluster + */ + protected CatalinaCluster cluster = null; + + /** + * Should listeners be notified? + */ + protected boolean notifyListenersOnReplication = true; + + /** * The pattern used for including session attributes to * replication, e.g. ^(userName|sessionHistory)$. * If not set, all session attributes will be eligible for replication. @@ -50,6 +61,27 @@ public abstract class ClusterManagerBase extends ManagerBase */ private Pattern sessionAttributePattern = null; + /* + * @see org.apache.catalina.ha.ClusterManager#getCluster() + */ + @Override + public CatalinaCluster getCluster() { + return cluster; + } + + @Override + public void setCluster(CatalinaCluster cluster) { + this.cluster = cluster; + } + + @Override + public boolean isNotifyListenersOnReplication() { + return notifyListenersOnReplication; + } + + public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication) { + this.notifyListenersOnReplication = notifyListenersOnReplication; + } /** * Return the string pattern used for including session attributes diff --git a/java/org/apache/catalina/ha/session/DeltaManager.java b/java/org/apache/catalina/ha/session/DeltaManager.java index a87b75e54..26c223366 100644 --- a/java/org/apache/catalina/ha/session/DeltaManager.java +++ b/java/org/apache/catalina/ha/session/DeltaManager.java @@ -87,7 +87,6 @@ public class DeltaManager extends ClusterManagerBase{ */ protected static String managerName = "DeltaManager"; protected String name = null; - private CatalinaCluster cluster = null; /** * cached replication valve cluster container! @@ -95,7 +94,6 @@ public class DeltaManager extends ClusterManagerBase{ private volatile ReplicationValve replicationValve = null ; private boolean expireSessionsOnShutdown = false; - private boolean notifyListenersOnReplication = true; private boolean notifySessionListenersOnReplication = true; private boolean notifyContainerListenersOnReplication = true; private volatile boolean stateTransfered = false ; @@ -412,15 +410,6 @@ public class DeltaManager extends ClusterManagerBase{ this.expireSessionsOnShutdown = expireSessionsOnShutdown; } - @Override - public boolean isNotifyListenersOnReplication() { - return notifyListenersOnReplication; - } - - public void setNotifyListenersOnReplication(boolean notifyListenersOnReplication) { - this.notifyListenersOnReplication = notifyListenersOnReplication; - } - public boolean isNotifyContainerListenersOnReplication() { return notifyContainerListenersOnReplication; } @@ -430,16 +419,6 @@ public class DeltaManager extends ClusterManagerBase{ this.notifyContainerListenersOnReplication = notifyContainerListenersOnReplication; } - @Override - public CatalinaCluster getCluster() { - return cluster; - } - - @Override - public void setCluster(CatalinaCluster cluster) { - this.cluster = cluster; - } - // --------------------------------------------------------- Public Methods /**