modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java | 5 ++- modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java | 13 +++++++-- modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 14 +++++----- 3 files changed, 21 insertions(+), 11 deletions(-)
New commits: commit b973af82febbaba656e06209af7922fcb1891df8 Author: John Sanda jsanda@redhat.com Date: Tue Feb 14 15:26:09 2012 -0500
[BZ 788638] Removing extra call to fetch managed object
We were making an extra call to getManagedCompoment in AbstractEjbComponent during metric collection. I discovered this while doing some profiling. With this change execution time for AbstractEjbBeanComponent.getValues is reduced by about 50% Also adding some logging in ManagedComponentComponent.getAvailability to indicate when an availability refresh is needed. This could be useful for tuning the interval.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java index c28dad2..a0fccc5 100644 --- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java +++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/AbstractEjbBeanComponent.java @@ -54,7 +54,8 @@ import org.rhq.core.pluginapi.operation.OperationResult; * @author Lukas Krejci * @author Ian Springer */ -public abstract class AbstractEjbBeanComponent extends ManagedComponentComponent implements OperationFacet { +public abstract class + AbstractEjbBeanComponent extends ManagedComponentComponent implements OperationFacet { private final Log log = LogFactory.getLog(this.getClass());
private static final String VIEW_INVOCATION_STATS_OPERATION_NAME = "viewInvocationStats"; @@ -83,7 +84,7 @@ public abstract class AbstractEjbBeanComponent extends ManagedComponentComponent } } // Let our superclass handle any metrics we didn't collect. - super.getValues(report, remainingRequests); + super.getValues(managedComponent, report, remainingRequests); }
@Override diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java index 201484e..f4ebef0 100644 --- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java +++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ManagedComponentComponent.java @@ -127,6 +127,11 @@ public class ManagedComponentComponent extends AbstractManagedComponent implemen public AvailabilityType getAvailability() { long timeSinceComponentRefresh = System.currentTimeMillis() - lastComponentRefresh; if (timeSinceComponentRefresh > availRefreshInterval) { + if (log.isDebugEnabled()) { + log.debug("The availability refresh interval for [resourceKey: " + getResourceContext().getResourceKey() + + ", type: " + componentType + ", name: " + componentName + "] has been exceeded by " + + (timeSinceComponentRefresh - availRefreshInterval) + " ms. Reloading managed component."); + } getManagedComponent(); }
@@ -249,7 +254,11 @@ public class ManagedComponentComponent extends AbstractManagedComponent implemen // MeasurementFacet Implementation --------------------------------------------
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception { - ManagedComponent managedComponent = getManagedComponent(); + getValues(getManagedComponent(), report, metrics); + } + + protected void getValues(ManagedComponent managedComponent, MeasurementReport report, + Set<MeasurementScheduleRequest> metrics) throws Exception { RunState runState = managedComponent.getRunState(); for (MeasurementScheduleRequest request : metrics) { try { @@ -260,7 +269,7 @@ public class ManagedComponentComponent extends AbstractManagedComponent implemen log.error("Failed to collect metric for " + request, e); } else { log.debug("Failed to collect metric for " + request - + ", but managed component is not in the RUNNING state.", e); + + ", but managed component is not in the RUNNING state.", e); } } } diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml index 38ae6b4..ab12497 100644 --- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml @@ -999,13 +999,13 @@
<c:simple-property name="serviceAvailabilityRefreshInterval" units="minutes" required="false" default="15" type="integer" - description="The amount of time, in minutes, that can elapse for service availability checks - without having to refresh the managed object from the server. Services cache information - used to perform availability checks. This property determines how frequently that - data needs to be reloaded from the server. Any time the managed object is - loaded from the server, like for collecting metrics, the availability information - is updated and the interval is reset. Note that this property does not effect the - frequency of availability scans performed by the agent."/> + description="The amount of time, in minutes, that can elapse for service resource + (e.g., EJBs, data sources) availability checks without having to refresh the + managed object from the JBoss server. The information used to perform availability + checks is cached. This property determines how frequently that data needs to be + reloaded from the JBoss server. Any time the managed object is loaded from the + server, like for collecting metrics, the availability information is updated and + the interval is reset."/>
<c:simple-property name="childJmxServerName" displayName="JBoss AS JVM Name" default="JVM" readOnly="true" required="false"
rhq-commits@lists.fedorahosted.org