You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2007/03/25 19:46:38 UTC
svn commit: r522314 - in /tomcat/container/tc5.5.x/modules:
cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
ha/src/share/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
Author: fhanik
Date: Sun Mar 25 10:46:37 2007
New Revision: 522314
URL: http://svn.apache.org/viewvc?view=rev&rev=522314
Log:
Backport for manager name from Tomcat 6 to Tomcat 5.5
Modified:
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java?view=diff&rev=522314&r1=522313&r2=522314
==============================================================================
--- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java (original)
+++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java Sun Mar 25 10:46:37 2007
@@ -623,33 +623,24 @@
* Returns the name for the cluster manager. This name
* depends on whether the cluster manager is defined inside
* a Host or an Engine.
- *
- * See also Bugzilla 39866:
- * http://issues.apache.org/bugzilla/show_bug.cgi?id=39866
- *
+ * Should the cluster be defined in the Engine element, the manager name
+ * is Host.getName+"#"+Context.getManager().getName()
+ * otherwise the name is simply Context.getManager().getName()
* @param name The current name
* @param manager The cluster manager implementation
* @return The name to use for the cluster manager
*/
- private String getManagerName(String name, Manager manager) {
- String clusterName = name;
-
- if (getContainer() instanceof Engine) {
- Container context = manager.getContainer();
-
- if (context instanceof Context) {
+ 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 instanceof Host) {
- // Bugzilla 39866 shows duplicate names
- // http://issues.apache.org/bugzilla/show_bug.cgi?id=39866
- if (! (host.getName().equals(name))) {
- clusterName = host.getName() + name;
- }
- }
+ if(host != null && host instanceof Host && clusterName!=null && !(clusterName.indexOf("#")>=0))
+ clusterName = host.getName() +"#" + clusterName ;
}
}
-
return clusterName;
}
Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?view=diff&rev=522314&r1=522313&r2=522314
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/tcp/SimpleTcpCluster.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Sun Mar 25 10:46:37 2007
@@ -546,18 +546,25 @@
}
/**
- * @param name
- * @param manager
- * @return
+ * Returns the name for the cluster manager. This name
+ * depends on whether the cluster manager is defined inside
+ * a Host or an Engine.
+ * Should the cluster be defined in the Engine element, the manager name
+ * is Host.getName+"#"+Context.getManager().getName()
+ * otherwise the name is simply Context.getManager().getName()
+ * @param name The current name
+ * @param manager The cluster manager implementation
+ * @return The name to use for the cluster manager
*/
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 = host.getName() + name ;
+ if(host != null && host instanceof Host && clusterName!=null && !(clusterName.indexOf("#")>=0))
+ clusterName = host.getName() +"#" + clusterName ;
}
}
return clusterName;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org