Bug 50503 - Engine level Clustering does not work correctly if the web application has a version.
Engine level Clustering does not work correctly if the web application has a ...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Cluster
trunk
All All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-12-21 01:42 UTC by Keiichi Fujino
Modified: 2010-12-21 01:58 UTC (History)
0 users



Attachments
I made a patch. (909 bytes, text/plain)
2010-12-21 01:44 UTC, Keiichi Fujino
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keiichi Fujino 2010-12-21 01:42:21 UTC
In Engine level clustering, the name of the cluster manager is  "HostName#contextName". 
SimpleTcpCluster#getManagerName(String, Manager) is as follows. 
====
public String getManagerName(String name, Manager manager) {
    String clusterName = name ;
    if ( clusterName == null ) clusterName = manager.getContainer().getName();
    if(getContainer() instanceof Engine) {
        Container context = manager.getContainer() ;
        if(context != null && context instanceof Context) {
            Container host = ((Context)context).getParent();
            if(host != null && host instanceof Host && clusterName!=null && !(clusterName.indexOf("#")>=0))
                clusterName = host.getName() +"#" + clusterName ;
        }
    }
    return clusterName;
}
====

In this method, clusterName.indexOf("#") >= 0 is checked. 

Because the context name becomes contextName##version if the web application has a version, 
the name of the cluster manager doesn't become a format of "HostName#contextName". 
As a result, Engine level Clustering doesn't work correctly. 

Best regards.
Comment 1 Keiichi Fujino 2010-12-21 01:44:09 UTC
Created attachment 26431 [details]
I made a patch.

I changed "clusterName.indexOf("#") >= 0" into "clusterName.startsWith(host.getName() +"#")".
Comment 2 Keiichi Fujino 2010-12-21 01:58:22 UTC
Fixed in 7.0.x and will be in 7.0.6 onwards.