brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [01/11] git commit: DynamicCluster: ensure cause of resize error is reported
Date Tue, 28 Oct 2014 15:37:12 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 36b81821e -> 7173c7576


DynamicCluster: ensure cause of resize error is reported


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

Branch: refs/heads/master
Commit: 3c9a4ff957e6bc01827f3ae2a107b295c35bacf4
Parents: 18dd4c4
Author: Aled Sage <aled.sage@gmail.com>
Authored: Fri Oct 24 17:03:02 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Oct 28 15:35:31 2014 +0000

----------------------------------------------------------------------
 .../brooklyn/entity/group/DynamicClusterImpl.java     | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3c9a4ff9/core/src/main/java/brooklyn/entity/group/DynamicClusterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/group/DynamicClusterImpl.java b/core/src/main/java/brooklyn/entity/group/DynamicClusterImpl.java
index 9cf8170..195348f 100644
--- a/core/src/main/java/brooklyn/entity/group/DynamicClusterImpl.java
+++ b/core/src/main/java/brooklyn/entity/group/DynamicClusterImpl.java
@@ -295,12 +295,16 @@ public class DynamicClusterImpl extends AbstractGroupImpl implements
DynamicClus
         int initialSize = getConfig(INITIAL_SIZE).intValue();
         int initialQuorumSize = getInitialQuorumSize();
 
+        Exception resizeException = null;
         try {
             resize(initialSize);
         } catch (Exception e) {
             Exceptions.propagateIfFatal(e);
-            // apart from logging, ignore problems here; we extract them below
+            // Apart from logging, ignore problems here; we extract them below.
+            // But if it was this thread that threw the exception (rather than a sub-task),
then need
+            // to record that failure here.
             LOG.debug("Error resizing "+this+" to size "+initialSize+" (collecting and handling):
"+e, e);
+            resizeException = e;
         }
 
         Iterable<Task<?>> failed = Tasks.failed(Tasks.children(Tasks.current()));
@@ -328,12 +332,16 @@ public class DynamicClusterImpl extends AbstractGroupImpl implements
DynamicClus
             }
             Throwable firstError = Tasks.getError(Maybe.next(failed.iterator()).orNull());
             if (firstError!=null) {
-                if (severalFailed)
+                if (severalFailed) {
                     message += "; first failure is: "+Exceptions.collapseText(firstError);
-                else
+                } else {
                     message += ": "+Exceptions.collapseText(firstError);
+                }
+            } else {
+                firstError = resizeException;
             }
             throw new IllegalStateException(message, firstError);
+            
         } else if (currentSize < initialSize) {
             LOG.warn(
                     "On start of cluster {}, size {} reached initial minimum quorum size
of {} but did not reach desired size {}; continuing",


Mime
View raw message