brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/7] git commit: Entities.waitForServiceUp: use finally block
Date Wed, 29 Oct 2014 16:19:42 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 1978c46f8 -> c37831d59


Entities.waitForServiceUp: use finally block


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

Branch: refs/heads/master
Commit: e9b22a4188c1b0af26c38c63500cbd28e6177727
Parents: 3f9ffe4
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Oct 28 19:20:16 2014 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Oct 29 09:20:16 2014 +0000

----------------------------------------------------------------------
 .../java/brooklyn/entity/basic/Entities.java    | 21 +++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e9b22a41/core/src/main/java/brooklyn/entity/basic/Entities.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/Entities.java b/core/src/main/java/brooklyn/entity/basic/Entities.java
index 24990ee..77a676d 100644
--- a/core/src/main/java/brooklyn/entity/basic/Entities.java
+++ b/core/src/main/java/brooklyn/entity/basic/Entities.java
@@ -1001,16 +1001,19 @@ public class Entities {
     public static void waitForServiceUp(final Entity entity, Duration timeout) {
         String description = "Waiting for SERVICE_UP on "+entity;
         Tasks.setBlockingDetails(description);
-        if (!Repeater.create(description).limitTimeTo(timeout)
-                .rethrowException().backoffTo(Duration.ONE_SECOND)
-                .until(new Callable<Boolean>() {
-                    public Boolean call() {
-                        return entity.getAttribute(Startable.SERVICE_UP);
-                    }})
-                .run()) {
-            throw new IllegalStateException("Timeout waiting for SERVICE_UP from "+entity);
+        try {
+            if (!Repeater.create(description).limitTimeTo(timeout)
+                    .rethrowException().backoffTo(Duration.ONE_SECOND)
+                    .until(new Callable<Boolean>() {
+                        public Boolean call() {
+                            return entity.getAttribute(Startable.SERVICE_UP);
+                        }})
+                    .run()) {
+                throw new IllegalStateException("Timeout waiting for SERVICE_UP from "+entity);
+            }
+        } finally {
+            Tasks.resetBlockingDetails();
         }
-        Tasks.resetBlockingDetails();
         log.debug("Detected SERVICE_UP for software {}", entity);
     }
     public static void waitForServiceUp(final Entity entity, long duration, TimeUnit units)
{


Mime
View raw message