modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 53 +++++----- 1 file changed, 27 insertions(+), 26 deletions(-)
New commits: commit 3de9ed57ad0ca55d59c22d0d48339f48c91b139e Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Jan 28 15:27:35 2013 -0500
Change some test logging from info to debug
CP master: ec3ef12e5300c0cecfe06fa7a693a8205e1e043c
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java index 1ac1423..2a2a80f 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java @@ -734,10 +734,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot // tree and chunk through it. Parents must be merged before children, so use a breadth first approach. List<Resource> resourceList = treeToBreadthFirstList(resource);
- // TODO: if (log.isDebugEnabled()) { - log.info("Preparing to merge [" + resourceList.size() + "] Resources with a batch size of [" + MERGE_BATCH_SIZE - + "]"); - //} + if (log.isDebugEnabled()) { + log.debug("Preparing to merge [" + resourceList.size() + "] Resources with a batch size of [" + + MERGE_BATCH_SIZE + "]"); + }
while (!resourceList.isEmpty()) { int size = resourceList.size(); @@ -750,10 +750,10 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot resourceBatch.clear(); }
- // TODO: if (log.isDebugEnabled()) { - log.info("Resource and children merged: resource/millis=" + resource.getName() + '/' - + (System.currentTimeMillis() - start)); - //} + if (log.isDebugEnabled()) { + log.debug("Resource and children merged: resource/millis=" + resource.getName() + '/' + + (System.currentTimeMillis() - start)); + }
return; } @@ -780,6 +780,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot throws InvalidInventoryReportException {
long batchStart = System.currentTimeMillis(); + boolean isDebugEnabled = log.isDebugEnabled();
for (Resource resource : resourceBatch) { Resource existingResource = null; @@ -796,17 +797,17 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot persistResourceInNewTransaction(resource); }
- //TODO: if (log.isDebugEnabled()) { - log.info("Single Resource merged: resource/millis=" + resource.getName() + '/' - + (System.currentTimeMillis() - start)); - //} + if (isDebugEnabled) { + log.debug("Single Resource merged: resource/millis=" + resource.getName() + '/' + + (System.currentTimeMillis() - start)); + } }
- //TODO: if (log.isDebugEnabled()) { - long delta = (System.currentTimeMillis() - batchStart); - log.info("Resource Batch merged: size/average/millis=" + resourceBatch.size() + "/" + delta - / resourceBatch.size() + "/" + delta); - //} + if (isDebugEnabled) { + long delta = (System.currentTimeMillis() - batchStart); + log.debug("Resource Batch merged: size/average/millis=" + resourceBatch.size() + "/" + delta + / resourceBatch.size() + "/" + delta); + } }
/** @@ -833,7 +834,9 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot */ private Resource findExistingResource(Resource resource) {
- if (log.isDebugEnabled()) { + boolean isDebugEnabled = log.isDebugEnabled(); + + if (isDebugEnabled) { log.debug("getExistingResource processing for [" + resource + "]"); }
@@ -843,21 +846,21 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot Subject overlord = subjectManager.getOverlord();
if (resource.getId() != 0) { - if (log.isDebugEnabled()) { + if (isDebugEnabled) { log.debug("Agent claims resource is already in inventory. Id=" + resource.getId()); }
try { query.setParameter("resourceId", resource.getId()); existingResource = (Resource) query.getSingleResult(); - if (log.isDebugEnabled()) { + if (isDebugEnabled) { log.debug("Found resource already in inventory. Id=" + resource.getId()); } } catch (NoResultException e) { existingResource = null;
// agent lied - agent's copy of JON server inventory must be stale. - if (log.isDebugEnabled()) { + if (isDebugEnabled) { log.debug("However, no resource exists with the specified id. Id=" + resource.getId()); } } @@ -869,7 +872,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot // this will happen if the agent found the resource (non-zero id) but the DB didn't know about it, // or if the agent didn't know about it to begin with (id was 0). if (existingResource == null) { - if (log.isDebugEnabled()) { + if (isDebugEnabled) { log.debug("Checking if a resource exists with the specified business key. Id=" + resource.getId() + ", key=" + resource.getResourceKey()); } @@ -910,7 +913,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot if (null != existingResource) { // We found it - reset the id to what it should be. resource.setId(existingResource.getId()); - if (log.isDebugEnabled()) { + if (isDebugEnabled) { log.debug("Found resource already in inventory with specified business key, Id=" + resource.getId()); }
@@ -924,9 +927,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot // TODO: Is there anything else we should do here to inform the agent it has an out-of-sync resource?
} else { - if (log.isDebugEnabled()) { - log.debug("Resource's id was already zero, nothing to do for the merge."); - } + log.debug("Resource's id was already zero, nothing to do for the merge."); } } }
rhq-commits@lists.fedorahosted.org