modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java | 24 ++++++---- 1 file changed, 16 insertions(+), 8 deletions(-)
New commits: commit 4403c93e9f56274644f397174582a0540c0195fc Author: Larry O'Leary loleary@redhat.com Date: Tue Jan 8 16:59:11 2013 -0600
Bug 905183 - [as5 plugin] Unable to collect metric from web application context due to WebApplicationContextComponent not initializing 'clustered' property value
Added code to verify that clustered has been initialized and if it has not, an attempt is made to initialize it. Additionally, it will not be used if it is not initialized.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java index 07708b7..dd63305 100644 --- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java +++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java @@ -142,16 +142,24 @@ public class WebApplicationContextComponent extends ManagedComponentComponent { report.addData(trait); } } else { - String metricNameToUse = metricName; - if (clustered && !"runState".equals(metricName)) { - metricNameToUse = toUpperCaseFirstLetter(metricName); + String value = null; + + /* + * Bug 737996 - Working around the property names inconsistency in the clustered web app contexts. + * If clustered we need to capitalize the first letter of the metric name to workaround JBPAPP-7172. + * If null is returned then we can assume that JBPAPP-7172 does not apply here and use the expected + * metric name. + */ + if (clustered == null) { + retrieveClusteredProperty(); }
- String value = getMeasurement(component, metricNameToUse); + if (clustered != null && clustered && !"runState".equals(metricName)) { + value = getMeasurement(component, toUpperCaseFirstLetter(metricName)); + }
- if (clustered && !"runState".equals(metricName) && value == null) { - //hmm... so it looks like https://issues.jboss.org/browse/JBPAPP-7172 has been fixed - //and we're getting the metric names in lower case even for clustered contexts + // value should be null unless app is clustered and JBPAPP-7172 applies + if (value == null) { value = getMeasurement(component, metricName); }
@@ -265,4 +273,4 @@ public class WebApplicationContextComponent extends ManagedComponentComponent {
return Character.toUpperCase(first) + name.substring(1); } -} \ No newline at end of file +}
rhq-commits@lists.fedorahosted.org