modules/plugins/platform/src/main/java/org/rhq/plugins/platform/ProcessComponent.java |
8 ++++++++
1 file changed, 8 insertions(+)
New commits:
commit 5c4217effa33ffd892f55005b09f7ed7201125f6
Author: Thomas SEGISMONT <tsegismo(a)redhat.com>
Date: Mon Nov 26 10:55:04 2012 +0100
[BZ-879583] Monitoring : process availability gives wrong status (SIGAR)
ProcessInfo instance needs to be refreshed on every avail check
diff --git
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/ProcessComponent.java
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/ProcessComponent.java
index 8281f70..9e9b95f 100644
---
a/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/ProcessComponent.java
+++
b/modules/plugins/platform/src/main/java/org/rhq/plugins/platform/ProcessComponent.java
@@ -67,6 +67,7 @@ public class ProcessComponent implements ResourceComponent,
MeasurementFacet {
private String piql;
private boolean fullProcessTree;
+ @Override
public void start(ResourceContext resourceContext) throws
InvalidPluginConfigurationException, Exception {
this.resourceContext = resourceContext;
@@ -89,9 +90,11 @@ public class ProcessComponent implements ResourceComponent,
MeasurementFacet {
}
}
+ @Override
public void stop() {
}
+ @Override
public AvailabilityType getAvailability() {
try {
return getProcess().isRunning() ? AvailabilityType.UP :
AvailabilityType.DOWN;
@@ -106,6 +109,10 @@ public class ProcessComponent implements ResourceComponent,
MeasurementFacet {
private ProcessInfo getProcess() throws Exception {
if (this.process == null || !this.process.isRunning()) {
this.process = getProcessForConfiguration();
+ } else {
+ // Refresh previously existing ProcessInfo as it may hold stale data.
+ // SIGAR objects do not get updated when, for example, a process goes down.
+ process.refresh();
}
return this.process;
}
@@ -168,6 +175,7 @@ public class ProcessComponent implements ResourceComponent,
MeasurementFacet {
return processInfo;
}
+ @Override
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
metrics) {
if (this.process != null) {
this.process.refresh();
Show replies by date