Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 593063 Details for
Bug 707349
tomcat plugin: get support for Tomcat 7 fully working
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
prototype patch to fix some things
bz707349.patch (text/plain), 7.22 KB, created by
John Mazzitelli
on 2012-06-19 20:16:35 UTC
(
hide
)
Description:
prototype patch to fix some things
Filename:
MIME Type:
Creator:
John Mazzitelli
Created:
2012-06-19 20:16:35 UTC
Size:
7.22 KB
patch
obsolete
>diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java >index 4013376..cc8ac80 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorComponent.java >@@ -84,6 +84,15 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > */ > public static final String PLUGIN_CONFIG_SHARED_EXECUTOR = "sharedExecutorName"; > >+ /** >+ * Plugin property name that is used to indicate if the new Tomcat 7 object name format is to be used >+ * when accessing the GlobalRequestProcessor MBean (see {@link #getGlobalRequestProcessorName()}). >+ * Tomcat 7 added double quotes around the name attribute value, which wasn't the case in earlier Tomcat versions. >+ * We now need to know which object name we should use. The discovery component can figure this out for us >+ * and it will set this value to appropriately. >+ */ >+ public static final String PLUGIN_CONFIG_GLOBAL_REQ_PROC_OBJECT_NAME = "globalRequestProcessorObjectName"; >+ > public static final String UNKNOWN = "?"; > > private final Log log = LogFactory.getLog(this.getClass()); >@@ -218,7 +227,9 @@ public class TomcatConnectorComponent extends MBeanResourceComponent<TomcatServe > } > > private String getGlobalRequestProcessorName() { >- String name = "Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%"; >+ Configuration pc = getResourceContext().getPluginConfiguration(); >+ String name = pc.getSimpleValue(PLUGIN_CONFIG_GLOBAL_REQ_PROC_OBJECT_NAME, >+ "Catalina:type=GlobalRequestProcessor,name=%handler%%address%-%port%"); > > return replaceGlobalRequestProcessorNameProps(name); > } >diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java >index 1591a5e..ac88c08 100644 >--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java >+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatConnectorDiscoveryComponent.java >@@ -116,6 +116,18 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > pluginConfiguration.put(new PropertySimple(TomcatConnectorComponent.PLUGIN_CONFIG_ADDRESS, address)); > } > >+ // Set the global request processor name if it is not the older format (Tomcat 7 added quotes around the name value) >+ String name = (null != configInfo) ? configInfo.getName() : null; >+ if ((null != name) && name.charAt(0) == '\"') { >+ String objname = "Catalina:type=GlobalRequestProcessor,name=\"%handler%%address%-%port%\""; >+ pluginConfiguration.put(new PropertySimple( >+ TomcatConnectorComponent.PLUGIN_CONFIG_GLOBAL_REQ_PROC_OBJECT_NAME, objname)); >+ if (log.isDebugEnabled()) { >+ log.debug("The older, default global request processor name is not valid - will explicit set its name to [" >+ + objname + "]"); >+ } >+ } >+ > // Let's try to auto-discover if this Connector is using a shared executor for its thread pool. > // If it is, let's set the plugin config property automatically so we can collect the proper metrics. > // Note that if the "executorName" attribute on the Connector MBean is "Internal", that means it is NOT shared. >@@ -159,24 +171,34 @@ public class TomcatConnectorDiscoveryComponent extends MBeanResourceDiscoveryCom > * 1) handler-port > * 2) handler-ipaddress-port > * 3) handler-host%2Fipaddress-port >- * >+ * 4) "handler-port" (literal double quotes) >+ * > * Option 2 or 3 occurs when the <address> is explicitly defined in the <connector> element. > * Option 3 occurs when the address is an alias. The alias is resolved and appended to the alias separated > * by '/' (encoded a slash comes through as %2F). Note that the host may have itself contain dashes '-'. >+ * Option 4 appears to be a newly introduced format in Tomcat 7. > */ > > try { >- int firstDash = name.indexOf('-'); >- int lastDash = name.lastIndexOf('-'); >- handler = name.substring(0, firstDash); >- port = name.substring(lastDash + 1); >+ // Tomcat 7 appears to wrap some names in double quotes; remote the quotes >+ String nameValue = name; >+ if (nameValue.charAt(0) == '\"') { >+ nameValue = nameValue.substring(1); >+ } >+ if (nameValue.endsWith("\"")) { >+ nameValue = nameValue.substring(0, nameValue.length() - 1); >+ } >+ int firstDash = nameValue.indexOf('-'); >+ int lastDash = nameValue.lastIndexOf('-'); >+ handler = nameValue.substring(0, firstDash); >+ port = nameValue.substring(lastDash + 1); > // validate that the port is a valid int > Integer.valueOf(port); > > // Check to see if an address portion exists > if (firstDash != lastDash) { > // For option 3 keep the alias and we'll resolve as needed >- String rawAddress = name.substring(firstDash + 1, lastDash); >+ String rawAddress = nameValue.substring(firstDash + 1, lastDash); > int delim = rawAddress.indexOf("%2F"); > address = (-1 == delim) ? rawAddress : rawAddress.substring(0, delim); > } >diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml >index ce7247f..c9c6dac 100644 >--- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml >+++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml >@@ -771,6 +771,11 @@ > type="string" > description="If this Connector is configured to use a shared Executor for its thread pool, this is the name of that Executor. This is required to successfully collect threadpool metrics for the Connector. Leave this unset if the Connector is not using a shared Executor for its threadpool." > required="false" /> >+ <c:simple-property >+ name="globalRequestProcessorObjectName" >+ type="string" >+ description="A Connector has an associated Global Request Processor MBean. However, different versions of Tomcat have different formats for their ObjectNames. If the default ObjectName is not valid for the version of Tomcat being managed, this will be the ObjectName to be used to communicate with this Connector's assocated Global Request Processor MBean." >+ required="false" /> > </c:group> > > <c:group
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 707349
:
500678
|
500679
| 593063 |
624151
|
627712