Author: fhanik Date: Tue Feb 28 15:08:57 2006 New Revision: 381814 URL: http://svn.apache.org/viewcvs?rev=381814&view=rev Log: Refactored cluster1 vs cluster2
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSetFactory.java tomcat/container/tc5.5.x/modules/ha/build.xml Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSetFactory.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSetFactory.java?rev=381814&r1=381813&r2=381814&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSetFactory.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSetFactory.java Tue Feb 28 15:08:57 2006 @@ -29,29 +29,49 @@ public static Log log = LogFactory.getLog(ClusterRuleSetFactory.class); public static RuleSetBase getClusterRuleSet(String prefix) { + + //OLD CLUSTER 1 //first try the same classloader as this class server/lib try { - return loadRuleSet(prefix,ClusterRuleSetFactory.class.getClassLoader()); + return loadRuleSet(prefix,"org.apache.catalina.cluster.ClusterRuleSet",ClusterRuleSetFactory.class.getClassLoader()); } catch ( Exception x ) { //display warning if ( log.isWarnEnabled() ) log.warn("Unable to load ClusterRuleSet, falling back on context classloader",x); } //try to load it from the context class loader try { - return loadRuleSet(prefix,Thread.currentThread().getContextClassLoader()); + return loadRuleSet(prefix,"org.apache.catalina.cluster.ClusterRuleSet",Thread.currentThread().getContextClassLoader()); } catch ( Exception x ) { //display warning - if ( log.isWarnEnabled() ) log.warn("Unable to load ClusterRuleSet, falling back on DefaultClusterRuleSet",x); + if ( log.isWarnEnabled() ) log.warn("Unable to load ClusterRuleSet, will try to load the HA cluster",x); } + + //NEW CLUSTER 2 + //first try the same classloader as this class server/lib + try { + return loadRuleSet(prefix,"org.apache.catalina.ha.ClusterRuleSet",ClusterRuleSetFactory.class.getClassLoader()); + } catch ( Exception x ) { + //display warning + if ( log.isWarnEnabled() ) log.warn("Unable to load HA ClusterRuleSet, falling back on context classloader",x); + } + //try to load it from the context class loader + try { + return loadRuleSet(prefix,"org.apache.catalina.ha.ClusterRuleSet",Thread.currentThread().getContextClassLoader()); + } catch ( Exception x ) { + //display warning + if ( log.isWarnEnabled() ) log.warn("Unable to load HA ClusterRuleSet, falling back on DefaultClusterRuleSet",x); + } + + return new DefaultClusterRuleSet(prefix); } - protected static RuleSetBase loadRuleSet(String prefix, ClassLoader cl) + protected static RuleSetBase loadRuleSet(String prefix, String className, ClassLoader cl) throws ClassNotFoundException, InstantiationException, NoSuchMethodException,IllegalAccessException, InvocationTargetException { - Class clazz = Class.forName("org.apache.catalina.cluster.ClusterRuleSet",true,cl); + Class clazz = Class.forName(className,true,cl); Constructor cons = clazz.getConstructor(new Class[] {String.class}); return (RuleSetBase)cons.newInstance(new String[] {prefix}); } Modified: tomcat/container/tc5.5.x/modules/ha/build.xml URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/build.xml?rev=381814&r1=381813&r2=381814&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/ha/build.xml (original) +++ tomcat/container/tc5.5.x/modules/ha/build.xml Tue Feb 28 15:08:57 2006 @@ -92,16 +92,16 @@ > <classpath refid="ha.classpath" /> </javac> - <copy file="${basedir}/src/share/org/apache/catalina/cluster/LocalStrings.properties" - tofile="${catalina.build}/classes/org/apache/catalina/cluster/LocalStrings.properties"/> - <copy file="${basedir}/src/share/org/apache/catalina/cluster/session/LocalStrings.properties" - tofile="${catalina.build}/classes/org/apache/catalina/cluster/session/LocalStrings.properties"/> - <copy file="${basedir}/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties" - tofile="${catalina.build}/classes/org/apache/catalina/cluster/tcp/LocalStrings.properties"/> - <copy file="${basedir}/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml" - tofile="${catalina.build}/classes/org/apache/catalina/cluster/session/mbeans-descriptors.xml"/> - <copy file="${basedir}/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml" - tofile="${catalina.build}/classes/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml"/> + <copy file="${basedir}/src/share/org/apache/catalina/ha/LocalStrings.properties" + tofile="${catalina.build}/classes/org/apache/catalina/ha/LocalStrings.properties"/> + <copy file="${basedir}/src/share/org/apache/catalina/ha/session/LocalStrings.properties" + tofile="${catalina.build}/classes/org/apache/catalina/ha/session/LocalStrings.properties"/> + <copy file="${basedir}/src/share/org/apache/catalina/ha/tcp/LocalStrings.properties" + tofile="${catalina.build}/classes/org/apache/catalina/ha/tcp/LocalStrings.properties"/> + <copy file="${basedir}/src/share/org/apache/catalina/ha/session/mbeans-descriptors.xml" + tofile="${catalina.build}/classes/org/apache/catalina/ha/session/mbeans-descriptors.xml"/> + <copy file="${basedir}/src/share/org/apache/catalina/ha/tcp/mbeans-descriptors.xml" + tofile="${catalina.build}/classes/org/apache/catalina/ha/tcp/mbeans-descriptors.xml"/> </target> @@ -138,7 +138,7 @@ <jar destfile="${ha.dist}/catalina-cluster.jar" basedir="${catalina.build}/classes"> - <include name="org/apache/catalina/cluster/**" /> + <include name="org/apache/catalina/ha/**" /> <exclude name="**/package.html" /> <exclude name="**/LocalStrings_*" /> </jar> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]