brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] brooklyn-server git commit: Fix adding multiple RendererHints for percentage enricher
Date Mon, 11 Jul 2016 14:30:01 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 12c645ecf -> 34c28995e


Fix adding multiple RendererHints for percentage enricher


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2c8e463b
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2c8e463b
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2c8e463b

Branch: refs/heads/master
Commit: 2c8e463b91ac950c22f0826b6eaf481a68d42ea1
Parents: c3dc6e8
Author: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Mon Jul 11 09:31:52 2016 +0100
Committer: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Mon Jul 11 12:27:15 2016 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/enricher/stock/PercentageEnricher.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2c8e463b/core/src/main/java/org/apache/brooklyn/enricher/stock/PercentageEnricher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/enricher/stock/PercentageEnricher.java
b/core/src/main/java/org/apache/brooklyn/enricher/stock/PercentageEnricher.java
index cd827d9..62fc867 100644
--- a/core/src/main/java/org/apache/brooklyn/enricher/stock/PercentageEnricher.java
+++ b/core/src/main/java/org/apache/brooklyn/enricher/stock/PercentageEnricher.java
@@ -90,7 +90,10 @@ public class PercentageEnricher extends AbstractEnricher implements SensorEventL
 
         subscriptions().subscribe(MutableMap.of("notifyOfInitialValue", true), producer,
sourceCurrentSensor, this);
         subscriptions().subscribe(MutableMap.of("notifyOfInitialValue", true), producer,
sourceTotalSensor, this);
-        RendererHints.register(targetSensor, RendererHints.displayValue(MathFunctions.percent(2)));
+
+        if (RendererHints.getHintsFor(targetSensor).isEmpty()) {
+            RendererHints.register(targetSensor, RendererHints.displayValue(MathFunctions.percent(2)));
+        }
     }
 
     @Override


Mime
View raw message