FileDocCategorySizeDatePackage
ClusterRuleSetFactory.javaAPI DocApache Tomcat 6.0.148894Fri Jul 20 04:20:32 BST 2007org.apache.catalina.startup

ClusterRuleSetFactory

public class ClusterRuleSetFactory extends Object

Fields Summary
public static org.apache.juli.logging.Log
log
Constructors Summary
Methods Summary
public static org.apache.tomcat.util.digester.RuleSetBasegetClusterRuleSet(java.lang.String prefix)

    
         
        
        //OLD CLUSTER 1
        //first try the same classloader as this class server/lib
        try {
            return loadRuleSet(prefix,"org.apache.catalina.cluster.ClusterRuleSet",ClusterRuleSetFactory.class.getClassLoader());
        } catch ( Exception x ) {
            //display warning
            if ( log.isDebugEnabled() ) log.debug("Unable to load ClusterRuleSet (org.apache.catalina.cluster.ClusterRuleSet), falling back on context classloader");
        }
        //try to load it from the context class loader
        try {
            return loadRuleSet(prefix,"org.apache.catalina.cluster.ClusterRuleSet",Thread.currentThread().getContextClassLoader());
        } catch ( Exception x ) {
            //display warning
            if ( log.isDebugEnabled() ) log.debug("Unable to load ClusterRuleSet (org.apache.catalina.cluster.ClusterRuleSet), will try to load the HA cluster");
        }
        
        //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.isDebugEnabled() ) log.debug("Unable to load HA ClusterRuleSet (org.apache.catalina.ha.ClusterRuleSet), falling back on context classloader");
        }
        //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.isDebugEnabled() ) log.debug("Unable to load HA ClusterRuleSet (org.apache.catalina.ha.ClusterRuleSet), falling back on DefaultClusterRuleSet");
        }

        log.info("Unable to find a cluster rule set in the classpath. Will load the default rule set.");
        return new DefaultClusterRuleSet(prefix);
    
protected static org.apache.tomcat.util.digester.RuleSetBaseloadRuleSet(java.lang.String prefix, java.lang.String className, java.lang.ClassLoader cl)

        Class clazz = Class.forName(className,true,cl);
        Constructor cons = clazz.getConstructor(new Class[] {String.class});
        return (RuleSetBase)cons.newInstance(prefix);