You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/10/17 12:24:16 UTC

[6/9] ensure feeds (and all entity tasks) are cancelled when entities are unmanaged, including in-memory test and an integration test with nginx; now it will GC entity tasks *after* fully unmanaged, but will cancel entity tasks *during* unmanage. also fi

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/232ee467/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java b/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
index 8acbbf9..1aafc1f 100644
--- a/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
+++ b/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
@@ -39,6 +39,7 @@ import com.google.common.base.Function;
 import com.google.common.base.Functions;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
+import com.google.common.base.Stopwatch;
 import com.google.common.util.concurrent.Callables;
 
 /**
@@ -304,6 +305,14 @@ public class Repeater {
         return runKeepingError().getWithoutError();
     }
     
+    public void runRequiringTrue() {
+        Stopwatch timer = Stopwatch.createStarted();
+        ReferenceWithError<Boolean> result = runKeepingError();
+        result.checkNoError();
+        if (!result.get()) 
+            throw new IllegalStateException(description+" unsatisfied after "+Duration.of(timer));
+    }
+    
     public ReferenceWithError<Boolean> runKeepingError() {
         Preconditions.checkState(body != null, "repeat() method has not been called to set the body");
         Preconditions.checkState(exitCondition != null, "until() method has not been called to set the exit condition");