tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1174181 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/ha/session/BackupManager.java java/org/apache/catalina/ha/session/ClusterManagerBase.java java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml
Date Thu, 22 Sep 2011 15:01:09 GMT
Author: rjung
Date: Thu Sep 22 15:01:08 2011
New Revision: 1174181

URL: http://svn.apache.org/viewvc?rev=1174181&view=rev
Log:
- Pull up members "cluster" and "notifyListenersOnReplication"
  to common base class.
- Pull up common clone code to base class.
- Add sessionAttributeFilter to clone method
- Reduce visibility of notifyListenersOnReplication

Backport of r1173088, r1173090, r1173461 from trunk.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 22 15:01:08 2011
@@ -1 +1 @@
-/tomcat/trunk:1156171,1156276,1156304,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173096,1173241,1173256,1173288,1173614,1173630,1173659
 ,1173722,1174061
+/tomcat/trunk:1156171,1156276,1156304,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096,1173241,1173256,1173288,1173461
 ,1173614,1173630,1173659,1173722,1174061

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java?rev=1174181&r1=1174180&r2=1174181&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java Thu Sep 22
15:01:08 2011
@@ -24,7 +24,6 @@ import org.apache.catalina.DistributedMa
 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 Clust
     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 Clust
         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 Clust
 
         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 Clust
     }
     
     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 Clust
     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;
     }
@@ -259,12 +225,9 @@ public class BackupManager extends Clust
     @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;
         return result;
     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java?rev=1174181&r1=1174180&r2=1174181&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/ClusterManagerBase.java Thu Sep
22 15:01:08 2011
@@ -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
         implements ClusterManager {
 
     /**
+     * A reference to the cluster
+     */
+    protected CatalinaCluster cluster = null;
+
+    /**
+     * Should listeners be notified?
+     */
+    private 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
      */
     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
@@ -147,4 +179,13 @@ public abstract class ClusterManagerBase
     public void unload() {
         // NOOP
     }
+
+    protected void clone(ClusterManagerBase copy) {
+        copy.name = "Clone-from-" + getName();
+        copy.cluster = getCluster();
+        copy.maxActiveSessions = getMaxActiveSessions();
+        copy.notifyListenersOnReplication = isNotifyListenersOnReplication();
+        copy.setSessionAttributeFilter(getSessionAttributeFilter());
+    }
+
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1174181&r1=1174180&r2=1174181&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Thu Sep 22
15:01:08 2011
@@ -87,7 +87,6 @@ public class DeltaManager extends Cluste
      */
     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 Cluste
     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 Cluste
         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 Cluste
         this.notifyContainerListenersOnReplication = notifyContainerListenersOnReplication;
     }
     
-    @Override
-    public CatalinaCluster getCluster() {
-        return cluster;
-    }
-
-    @Override
-    public void setCluster(CatalinaCluster cluster) {
-        this.cluster = cluster;
-    }
-
     // --------------------------------------------------------- Public Methods
 
     /**
@@ -1340,7 +1319,7 @@ public class DeltaManager extends Cluste
             try {
                 session.lock();
                 DeltaRequest dreq = deserializeDeltaRequest(session, delta);
-                dreq.execute(session, notifyListenersOnReplication);
+                dreq.execute(session, isNotifyListenersOnReplication());
                 session.setPrimarySession(false);
             }finally {
                 session.unlock();
@@ -1500,12 +1479,9 @@ public class DeltaManager extends Cluste
     @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;

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1174181&r1=1174180&r2=1174181&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Sep 22 15:01:08 2011
@@ -175,6 +175,10 @@
   </subsection>
   <subsection name="Cluster">
     <changelog>
+      <update>
+        Refactor cluster manager configuration: move handling of common
+        attributes to base class. (kfujino, rjung)
+      </update>
       <add>
         New cluster manager attribute <code>sessionAttributeFilter</code>
         allows to filter which session attributes are replicated using a



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message