tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1220293 - in /tomcat/trunk: java/org/apache/catalina/startup/Catalina.java java/org/apache/catalina/startup/LocalStrings.properties res/checkstyle/org-import-control.xml
Date Sat, 17 Dec 2011 22:52:18 GMT
Author: markt
Date: Sat Dec 17 22:52:18 2011
New Revision: 1220293

URL: http://svn.apache.org/viewvc?rev=1220293&view=rev
Log:
Fix cyclic JAR dependency and add check to ensure it doesn't return

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
    tomcat/trunk/res/checkstyle/org-import-control.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1220293&r1=1220292&r2=1220293&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Sat Dec 17 22:52:18 2011
@@ -22,6 +22,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.lang.reflect.Constructor;
 import java.net.Socket;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -34,13 +35,13 @@ import org.apache.catalina.LifecycleExce
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.Server;
 import org.apache.catalina.core.StandardServer;
-import org.apache.catalina.ha.ClusterRuleSet;
 import org.apache.catalina.security.SecurityConfig;
 import org.apache.juli.ClassLoaderLogManager;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.IntrospectionUtils;
 import org.apache.tomcat.util.digester.Digester;
 import org.apache.tomcat.util.digester.Rule;
+import org.apache.tomcat.util.digester.RuleSet;
 import org.apache.tomcat.util.log.SystemLogHandler;
 import org.apache.tomcat.util.res.StringManager;
 import org.xml.sax.Attributes;
@@ -372,13 +373,13 @@ public class Catalina {
         digester.addRuleSet(new EngineRuleSet("Server/Service/"));
         digester.addRuleSet(new HostRuleSet("Server/Service/Engine/"));
         digester.addRuleSet(new ContextRuleSet("Server/Service/Engine/Host/"));
-        digester.addRuleSet(new ClusterRuleSet("Server/Service/Engine/Host/Cluster/"));
+        addClusterRuleSet(digester, "Server/Service/Engine/Host/Cluster/");
         digester.addRuleSet(new NamingRuleSet("Server/Service/Engine/Host/Context/"));
 
         // When the 'engine' is found, set the parentClassLoader.
         digester.addRule("Server/Service/Engine",
                          new SetParentClassLoaderRule(parentClassLoader));
-        digester.addRuleSet(new ClusterRuleSet("Server/Service/Engine/Cluster/"));
+        addClusterRuleSet(digester, "Server/Service/Engine/Cluster/");
 
         long t2=System.currentTimeMillis();
         if (log.isDebugEnabled()) {
@@ -388,6 +389,27 @@ public class Catalina {
 
     }
 
+    /**
+     * Cluster support is optional. The JARs may have been removed.
+     */
+    private void addClusterRuleSet(Digester digester, String prefix) {
+        Class<?> clazz = null;
+        Constructor<?> constructor = null;
+        try {
+            clazz = Class.forName("org.apache.catalina.ha.ClusterRuleSet");
+            constructor = clazz.getConstructor(String.class);
+            RuleSet ruleSet = (RuleSet) constructor.newInstance(prefix);
+            digester.addRuleSet(ruleSet);
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("catalina.noCluster",
+                        e.getClass().getName() + ": " +  e.getMessage()), e);
+            } else if (log.isInfoEnabled()) {
+                log.info(sm.getString("catalina.noCluster",
+                        e.getClass().getName() + ": " +  e.getMessage()));
+            }
+        }
+    }
 
     /**
      * Create and configure the Digester we will be using for shutdown.

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1220293&r1=1220292&r2=1220293&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Sat Dec 17 22:52:18
2011
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 catalina.configFail=Unable to load server configuration from [{0}]
+catalina.noCluster=Cluster RuleSet not found due to [{0}]. Cluster configuration disabled.
 catalina.shutdownHookFail=The shutdown hook experienced an error while trying to stop the
server
 catalina.stopServer=No shutdown port configured. Shut down server through OS signal. Server
not shut down.
 contextConfig.altDDNotFound=alt-dd file {0} not found

Modified: tomcat/trunk/res/checkstyle/org-import-control.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/res/checkstyle/org-import-control.xml?rev=1220293&r1=1220292&r2=1220293&view=diff
==============================================================================
--- tomcat/trunk/res/checkstyle/org-import-control.xml (original)
+++ tomcat/trunk/res/checkstyle/org-import-control.xml Sat Dec 17 22:52:18 2011
@@ -40,6 +40,8 @@
     <allow pkg="javax.persistence"/>
     <allow pkg="javax.servlet"/>
     <allow pkg="org.apache.catalina"/>
+    <disallow pkg="org.apache.catalina.ha"/>
+    <disallow pkg="org.apache.catalina.tribes"/>
     <allow pkg="org.apache.coyote"/>
     <allow pkg="org.apache.juli"/>
     <allow pkg="org.apache.naming"/>
@@ -62,6 +64,7 @@
       <disallow pkg="org.apache.coyote"/>
       <disallow pkg="org.apache.naming"/>
       <allow pkg="org.apache.catalina.ha"/>
+      <allow pkg="org.apache.catalina.tribes"/>
     </subpackage>
     <subpackage name="tribes">
       <disallow pkg="javax.annotation"/>



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


Mime
View raw message