You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by David Knox <dk...@mac.com> on 2009/03/23 21:59:26 UTC

dead code in ClusterRuleSetFactory

Hi,
I have a customer who was confused by a couple of debug log messages  
coming from o.a.c.startup.ClusterRuleSetFactory. I found the code  
refers to a package present in Tomcat 5 but does not exist in Tomcat  
6 - org.apache.catalina.cluster; which appears to be dead code.
(http://svn.apache.org/repos/asf/tomcat/archive/tc5.0.x/trunk/ 
container/modules/cluster/)

Nevertheless,
In the interest of helping clean the code up a bit, I offer the patch  
below. The only reason to keep it that I could imagine was someone  
hijacking the package name (o.a.c.cluster) and their own clustering  
implementation; which seems impractical and ambitious.

cheers,
-- dave


Index: ClusterRuleSetFactory.java
===================================================================
--- ClusterRuleSetFactory.java   (revision 757534)
+++ ClusterRuleSetFactory.java   (working copy)
@@ -33,22 +33,6 @@

      public static RuleSetBase getClusterRuleSet(String prefix) {

-        //OLD CLUSTER 1
-        //first try the same classloader as this class server/lib
-        try {
-            return loadRuleSet 
(prefix,"org.apache.catalina.cluster.ClusterRuleSet",ClusterRuleSetFacto 
ry.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.currentThrea 
d().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 {




David Knox
Information System Architect
+1 303-748-8906
http://pragmaticis.blogspot.com





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


Re: dead code in ClusterRuleSetFactory

Posted by David Knox <dk...@mac.com>.
Thanks Peter.


David Knox
Information System Architect
+1 303-748-8906
http://pragmaticis.blogspot.com




On Mar 23, 2009, at 4:24 PM, Peter Rossbach wrote:

> Hi David,
>
> it ist not a dead code. Locking art sandbox OACC project we have  
> made the tomcat 5.5 cluster
> also available for tomcat 6.
>
> http://svn.apache.org/repos/asf/tomcat/sandbox/tomcat-oacc/trunk/
>
> The OACC module is very helpfull to migrations.
>
> Peter
>
>
> Am 23.03.2009 um 21:59 schrieb David Knox:
>
>> Hi,
>> I have a customer who was confused by a couple of debug log  
>> messages coming from o.a.c.startup.ClusterRuleSetFactory. I found  
>> the code refers to a package present in Tomcat 5 but does not  
>> exist in Tomcat 6 - org.apache.catalina.cluster; which appears to  
>> be dead code.
>> (http://svn.apache.org/repos/asf/tomcat/archive/tc5.0.x/trunk/ 
>> container/modules/cluster/)
>>
>> Nevertheless,
>> In the interest of helping clean the code up a bit, I offer the  
>> patch below. The only reason to keep it that I could imagine was  
>> someone hijacking the package name (o.a.c.cluster) and their own  
>> clustering implementation; which seems impractical and ambitious.
>>
>> cheers,
>> -- dave
>>
>>
>> Index: ClusterRuleSetFactory.java
>> ===================================================================
>> --- ClusterRuleSetFactory.java   (revision 757534)
>> +++ ClusterRuleSetFactory.java   (working copy)
>> @@ -33,22 +33,6 @@
>>
>>      public static RuleSetBase getClusterRuleSet(String prefix) {
>>
>> -        //OLD CLUSTER 1
>> -        //first try the same classloader as this class server/lib
>> -        try {
>> -            return loadRuleSet 
>> (prefix,"org.apache.catalina.cluster.ClusterRuleSet",ClusterRuleSetFa 
>> ctory.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.currentTh 
>> read().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 {
>>
>>
>>
>>
>> David Knox
>> Information System Architect
>> +1 303-748-8906
>> http://pragmaticis.blogspot.com
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>


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


Re: dead code in ClusterRuleSetFactory

Posted by Peter Rossbach <pr...@objektpark.de>.
Hi David,

it ist not a dead code. Locking art sandbox OACC project we have made  
the tomcat 5.5 cluster
also available for tomcat 6.

http://svn.apache.org/repos/asf/tomcat/sandbox/tomcat-oacc/trunk/

The OACC module is very helpfull to migrations.

Peter


Am 23.03.2009 um 21:59 schrieb David Knox:

> Hi,
> I have a customer who was confused by a couple of debug log  
> messages coming from o.a.c.startup.ClusterRuleSetFactory. I found  
> the code refers to a package present in Tomcat 5 but does not exist  
> in Tomcat 6 - org.apache.catalina.cluster; which appears to be dead  
> code.
> (http://svn.apache.org/repos/asf/tomcat/archive/tc5.0.x/trunk/ 
> container/modules/cluster/)
>
> Nevertheless,
> In the interest of helping clean the code up a bit, I offer the  
> patch below. The only reason to keep it that I could imagine was  
> someone hijacking the package name (o.a.c.cluster) and their own  
> clustering implementation; which seems impractical and ambitious.
>
> cheers,
> -- dave
>
>
> Index: ClusterRuleSetFactory.java
> ===================================================================
> --- ClusterRuleSetFactory.java   (revision 757534)
> +++ ClusterRuleSetFactory.java   (working copy)
> @@ -33,22 +33,6 @@
>
>      public static RuleSetBase getClusterRuleSet(String prefix) {
>
> -        //OLD CLUSTER 1
> -        //first try the same classloader as this class server/lib
> -        try {
> -            return loadRuleSet 
> (prefix,"org.apache.catalina.cluster.ClusterRuleSet",ClusterRuleSetFac 
> tory.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.currentThr 
> ead().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 {
>
>
>
>
> David Knox
> Information System Architect
> +1 303-748-8906
> http://pragmaticis.blogspot.com
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>