Pull up members "cluster" and "notifyListenersOnReplication"
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Sep 2011 11:32:49 +0000 (11:32 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Sep 2011 11:32:49 +0000 (11:32 +0000)
to common base class.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1173088 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/session/BackupManager.java
java/org/apache/catalina/ha/session/ClusterManagerBase.java
java/org/apache/catalina/ha/session/DeltaManager.java

index 2d0a53a..73e889a 100644 (file)
@@ -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;
     }
index 978ca22..2829c3a 100644 (file)
@@ -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. <code>^(userName|sessionHistory)$</code>.
      *  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
index a87b75e..26c2233 100644 (file)
@@ -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
 
     /**