From: <hr...@rh...> - 2008-11-07 18:05:43
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [1916] Get checking for duplicate traits to actually work on traits.</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>1916</dd> <dt>Author</dt> <dd>hrupp</dd> <dt>Date</dt> <dd>2008-11-07 12:05:38 -0600 (Fri, 07 Nov 2008)</dd> </dl> <h3>Log Message</h3> <pre>Get checking for duplicate traits to actually work on traits. RHQ-1075</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcmeasurementMeasurementManagerjava">rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java</a></li> <li><a href="#rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcmeasurementMeasurementSenderRunnerjava">rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcmeasurementMeasurementManagerjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java (1915 => 1916)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java 2008-11-07 18:05:07 UTC (rev 1915) +++ rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementManager.java 2008-11-07 18:05:38 UTC (rev 1916) </span><span class="lines">@@ -215,14 +215,16 @@ </span><span class="cx"> } /** </span><span class="add">+ * Check if the passed trait is new or has changed </span><span class="cx"> * @param scheduleId * @param traitValue * * @return true if the value is new or changed and should be included in the report */ public boolean checkTrait(int scheduleId, String traitValue) { </span><span class="rem">- String historic = traitCache.get(scheduleId); </span><span class="add">+ </span><span class="cx"> if (traitCache.containsKey(scheduleId)) { </span><span class="add">+ String historic = traitCache.get(scheduleId); </span><span class="cx"> if (((historic == null) && (traitValue != null)) || ((historic != null) && !historic.equals(traitValue))) { traitCache.put(scheduleId, traitValue); return true; </span></pre></div> <a id="rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcmeasurementMeasurementSenderRunnerjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java (1915 => 1916)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java 2008-11-07 18:05:07 UTC (rev 1915) +++ rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/measurement/MeasurementSenderRunner.java 2008-11-07 18:05:38 UTC (rev 1916) </span><span class="lines">@@ -1,33 +1,34 @@ </span><span class="rem">- /* - * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation, and/or the GNU Lesser - * General Public License, version 2.1, also as published by the Free - * Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License and the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation, and/or the GNU Lesser + * General Public License, version 2.1, also as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with this program; + * if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ </span><span class="cx"> package org.rhq.core.pc.measurement; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; </span><span class="add">+ </span><span class="cx"> import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; </span><span class="rem">-import org.rhq.core.domain.measurement.MeasurementData; </span><span class="add">+ </span><span class="cx"> import org.rhq.core.domain.measurement.MeasurementDataTrait; import org.rhq.core.domain.measurement.MeasurementReport; </span><span class="lines">@@ -54,35 +55,32 @@ </span><span class="cx"> this.measurementManager.perMinuteItizeData(report); if (report.getDataCount() > 0) { </span><span class="rem">- LOG.info("Measurement collection for [" + report.getDataCount() + "] metrics took " + - report.getCollectionTime() + "ms - sending report to Server..."); </span><span class="add">+ LOG.info("Measurement collection for [" + report.getDataCount() + "] metrics took " + + report.getCollectionTime() + "ms - sending report to Server..."); </span><span class="cx"> this.measurementManager.sendMeasurementReport(report); } else { LOG.debug("Measurement report contains no data - not sending to Server."); } </span><span class="rem">- </span><span class="add">+ </span><span class="cx"> return report; } private void filterUnchangedTraits(MeasurementReport report) { </span><span class="rem">- // TODO This is horribly inefficient because we're iterating the whole collection list for every set of collections </span><span class="add">+ </span><span class="cx"> // now filter TRAITS that have not changed since the last time </span><span class="rem">- List<MeasurementDataTrait> duplicates = new ArrayList<MeasurementDataTrait>(); - for (MeasurementData item : report.getNumericData()) { - if (item instanceof MeasurementDataTrait) { - MeasurementDataTrait trait = (MeasurementDataTrait) item; </span><span class="add">+ List<MeasurementDataTrait> duplicates = new ArrayList<MeasurementDataTrait>(report.getTraitData().size()); </span><span class="cx"> </span><span class="rem">- if (!this.measurementManager.checkTrait(trait.getScheduleId(), trait.getValue())) // we have an old value and it is the same as this - { - duplicates.add(trait); - if (LOG.isDebugEnabled()) { - LOG.debug("Trait " + trait.getName() + " with id " + trait.getScheduleId() + " is a dup"); - } </span><span class="add">+ for (MeasurementDataTrait trait : report.getTraitData()) { + if (!this.measurementManager.checkTrait(trait.getScheduleId(), trait.getValue())) // we have an old value and it is the same as this + { + duplicates.add(trait); + if (LOG.isTraceEnabled()) { + LOG.trace("Trait " + trait.getName() + " with id " + trait.getScheduleId() + " is a dup"); </span><span class="cx"> } } } </span><span class="rem">- report.getNumericData().removeAll(duplicates); </span><span class="add">+ report.getTraitData().removeAll(duplicates); </span><span class="cx"> } public void run() { </span> </pre> </div> </div> </body> </html> |