brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [04/11] git commit: Fix listAttributesWhenReady
Date Mon, 01 Sep 2014 16:55:35 GMT
Fix listAttributesWhenReady

- was not using readinessPredicate, so infinite loop
- also removes compiler warning in attributeWhenReady


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

Branch: refs/heads/master
Commit: afb2b6f2c6bff160c14cdc449d18a21d4260621e
Parents: bfc567d
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Aug 18 08:29:28 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Aug 18 08:30:34 2014 +0100

----------------------------------------------------------------------
 .../java/brooklyn/event/basic/DependentConfiguration.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/afb2b6f2/core/src/main/java/brooklyn/event/basic/DependentConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/event/basic/DependentConfiguration.java b/core/src/main/java/brooklyn/event/basic/DependentConfiguration.java
index 042758a..e549bd5 100644
--- a/core/src/main/java/brooklyn/event/basic/DependentConfiguration.java
+++ b/core/src/main/java/brooklyn/event/basic/DependentConfiguration.java
@@ -99,8 +99,8 @@ public class DependentConfiguration {
         return attributeWhenReady(source, sensor, GroovyJavaMethods.truthPredicate());
     }
     
-    public static <T> Task<T> attributeWhenReady(Entity source, AttributeSensor<T>
sensor, Closure ready) {
-        Predicate<T> readyPredicate = (ready != null) ? GroovyJavaMethods.predicateFromClosure(ready)
: GroovyJavaMethods.truthPredicate();
+    public static <T> Task<T> attributeWhenReady(Entity source, AttributeSensor<T>
sensor, Closure<Boolean> ready) {
+        Predicate<Object> readyPredicate = (ready != null) ? GroovyJavaMethods.<Object>predicateFromClosure(ready)
: GroovyJavaMethods.truthPredicate();
         return attributeWhenReady(source, sensor, readyPredicate);
     }
     
@@ -346,9 +346,9 @@ public class DependentConfiguration {
         return listAttributesWhenReady(sensor, entities, GroovyJavaMethods.truthPredicate());
     }
     
-    public static <T> Task<List<T>> listAttributesWhenReady(AttributeSensor<T>
sensor, Iterable<Entity> entities, Closure readiness) {
-        Predicate<T> readinessPredicate = (readiness != null) ? GroovyJavaMethods.predicateFromClosure(readiness)
: GroovyJavaMethods.truthPredicate();
-        return listAttributesWhenReady(sensor, entities, readiness);
+    public static <T> Task<List<T>> listAttributesWhenReady(AttributeSensor<T>
sensor, Iterable<Entity> entities, Closure<Boolean> readiness) {
+        Predicate<Object> readinessPredicate = (readiness != null) ? GroovyJavaMethods.<Object>predicateFromClosure(readiness)
: GroovyJavaMethods.truthPredicate();
+        return listAttributesWhenReady(sensor, entities, readinessPredicate);
     }
     
     /** returns a task for parallel execution returning a list of values of the given sensor
list on the given entity, 


Mime
View raw message