Author: rmorgan
Date: 2007-03-08 09:41:37 -0800 (Thu, 08 Mar 2007)
New Revision: 3667
URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3667
Modified:
trunk/src/org/hyperic/hq/measurement/server/session/SRNManagerEJBImpl.java
Log:
Attempt to load SRNs from the database if they are not found in the SRNCache. In clustered
environments where we only do invalidation we need to be able to reload the SRNs.
Modified: trunk/src/org/hyperic/hq/measurement/server/session/SRNManagerEJBImpl.java
===================================================================
--- trunk/src/org/hyperic/hq/measurement/server/session/SRNManagerEJBImpl.java 2007-03-08 13:05:17 UTC (rev 3666)
+++ trunk/src/org/hyperic/hq/measurement/server/session/SRNManagerEJBImpl.java 2007-03-08 17:41:37 UTC (rev 3667)
@@ -195,13 +195,23 @@
HashSet nonEntities = new HashSet();
for (int i = 0; i < srns.length; i++) {
- ScheduleRevNum srn = cache.get(srns[i].getEntity());
+ AppdefEntityID id = srns[i].getEntity();
+ ScheduleRevNum srn = cache.get(id);
if (srn == null) {
- _log.error("Agent's reporting for non-existing entity: "
- + srns[i].getEntity());
- nonEntities.add(srns[i].getEntity());
- continue;
+ // Attempt load from database, we pre-load the SRNCache, but
+ // in clustered environments we'll need to reload from the
+ // database.
+ SrnId srnId = new SrnId(id.getType(), id.getID());
+ srn = getScheduleRevNumDAO().findById(srnId);
+ if (srn == null) {
+ _log.error("Agent's reporting for non-existing entity: "
+ + srns[i].getEntity());
+ nonEntities.add(srns[i].getEntity());
+ continue;
+ } else {
+ cache.put(srn);
+ }
}
synchronized (srn) {
|