You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kf...@apache.org on 2013/10/30 06:43:52 UTC

svn commit: r1536970 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/ha/session/DeltaManager.java webapps/docs/changelog.xml

Author: kfujino
Date: Wed Oct 30 05:43:51 2013
New Revision: 1536970

URL: http://svn.apache.org/r1536970
Log:
Simplify the code of DeltaManager#startInternal().
Reduce unnecessary nesting for acquisition of cluster instance.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/DeltaManager.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

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=1536970&r1=1536969&r2=1536970&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 Wed Oct 30 05:43:51 2013
@@ -753,27 +753,15 @@ public class DeltaManager extends Cluste
             //the channel is already running
             Cluster cluster = getCluster() ;
             // stop remove cluster binding
-            //wow, how many nested levels of if statements can we have ;)
             if(cluster == null) {
-                Container context = getContainer() ;
-                if(context != null && context instanceof Context) {
-                     Container host = context.getParent() ;
-                     if(host != null && host instanceof Host) {
-                         cluster = host.getCluster();
-                         if(cluster != null && cluster instanceof CatalinaCluster) {
-                             setCluster((CatalinaCluster) cluster) ;
-                         } else {
-                             Container engine = host.getParent() ;
-                             if(engine != null && engine instanceof Engine) {
-                                 cluster = engine.getCluster();
-                                 if(cluster != null && cluster instanceof CatalinaCluster) {
-                                     setCluster((CatalinaCluster) cluster) ;
-                                 }
-                             } else {
-                                     cluster = null ;
-                             }
-                         }
-                     }
+                Container context = getContainer();
+                if (context != null) {
+                    cluster = context.getCluster();
+                    if(cluster instanceof CatalinaCluster) {
+                        setCluster((CatalinaCluster) cluster);
+                    } else {
+                        cluster = null;
+                    }
                 }
             }
             if (cluster == null) {

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=1536970&r1=1536969&r2=1536970&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Oct 30 05:43:51 2013
@@ -134,6 +134,10 @@
         <code>MapMessage#getKey()</code> and <code>getValue()</code> instead of
         Null return and error log. (kfujino)
       </fix>
+      <scode>
+        Simplify the code of <code>DeltaManager#startInternal()</code>. Reduce
+        unnecessary nesting for acquisition of cluster instance. (kfujino)
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Web applications">



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