- Pull up common clode code to base class.
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Sep 2011 11:36:29 +0000 (11:36 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Sep 2011 11:36:29 +0000 (11:36 +0000)
- Add sessionAttributeFilter to clone method
- Reduce visibility of notifyListenersOnReplication

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1173090 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 73e889a..b332cc7 100644 (file)
@@ -225,10 +225,8 @@ public class BackupManager extends ClusterManagerBase
     @Override
     public ClusterManager cloneFromTemplate() {
         BackupManager result = new BackupManager();
+        clone(result);
         result.mExpireSessionsOnShutdown = mExpireSessionsOnShutdown;
-        result.name = "Clone-from-"+name;
-        result.cluster = cluster;
-        result.notifyListenersOnReplication = notifyListenersOnReplication;
         result.mapSendOptions = mapSendOptions;
         result.maxActiveSessions = maxActiveSessions;
         result.rpcTimeout = rpcTimeout;
index 2829c3a..561de7b 100644 (file)
@@ -45,7 +45,7 @@ public abstract class ClusterManagerBase extends ManagerBase
     /**
      * Should listeners be notified?
      */
-    protected boolean notifyListenersOnReplication = true;
+    private boolean notifyListenersOnReplication = true;
 
     /**
      * The pattern used for including session attributes to
@@ -179,4 +179,13 @@ public abstract class ClusterManagerBase extends ManagerBase
     public void unload() {
         // NOOP
     }
+
+    protected void clone(ClusterManagerBase copy) {
+        copy.name = "Clone-from-" + getName();
+        copy.cluster = getCluster();
+        copy.maxActiveSessions = getMaxActiveSessions();
+        copy.notifyListenersOnReplication = isNotifyListenersOnReplication();
+        copy.sessionAttributeFilter = getSessionAttributeFilter();
+    }
+
 }
index 26c2233..d45d281 100644 (file)
@@ -1319,7 +1319,7 @@ public class DeltaManager extends ClusterManagerBase{
             try {
                 session.lock();
                 DeltaRequest dreq = deserializeDeltaRequest(session, delta);
-                dreq.execute(session, notifyListenersOnReplication);
+                dreq.execute(session, isNotifyListenersOnReplication());
                 session.setPrimarySession(false);
             }finally {
                 session.unlock();
@@ -1479,12 +1479,9 @@ public class DeltaManager extends ClusterManagerBase{
     @Override
     public ClusterManager cloneFromTemplate() {
         DeltaManager result = new DeltaManager();
-        result.name = "Clone-from-"+name;
-        result.cluster = cluster;
+        clone(result);
         result.replicationValve = replicationValve;
-        result.maxActiveSessions = maxActiveSessions;
         result.expireSessionsOnShutdown = expireSessionsOnShutdown;
-        result.notifyListenersOnReplication = notifyListenersOnReplication;
         result.notifySessionListenersOnReplication = notifySessionListenersOnReplication;
         result.notifyContainerListenersOnReplication = notifyContainerListenersOnReplication;
         result.stateTransferTimeout = stateTransferTimeout;