modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
| 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit b84dcfa9e3f141d2431665b592cab9c95655a0e7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Dec 6 16:01:03 2013 -0500
[1037616] Pull calls to find current availability out of the processing loop
A fix in the new impl to handle multiple updates for the same resource in
the same report. In general an avail report should only have one update for
one resource, but the potential for building up reports looms in the
future, and we do have this scenario in test code.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index 0e73794..34922fe 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -888,6 +888,9 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
latest = entityManager.merge(latest);
}
+ // update the Map to reflect the repaired latest avail
+ latestAvailabilities.put(resourceId, latest);
+
updateResourceAvailability(latest);
// ask the agent for a full report so as to ensure we are in sync
with agent
@@ -926,6 +929,9 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
latest = latestList.get(latestCount - 1);
updateResourceAvailability(latest);
+ // update the Map to reflect the repaired latest avail
+ latestAvailabilities.put(resourceId, latest);
+
// this is an unusual report - ask the agent for a full report so as
to ensure we are in sync with agent
mergeInfo.setAskForFullReport(true);
@@ -958,6 +964,10 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
// we are run-length encoded, so only persist data if the availability
changed
if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
entityManager.persist(reported);
+ // the reported avail is the new latest avail, update the Map in case
we have multiple reported
+ // changes for the same resource in this report
+ latestAvailabilities.put(resourceId, reported);
+
mergeInfo.incrementNumInserted();
latest.setEndTime(reported.getStartTime());
Show replies by date