brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [11/25] git commit: SoftwareProcess.rebind connect sensors improvements
Date Sun, 01 Jun 2014 20:15:26 GMT
SoftwareProcess.rebind connect sensors improvements

- connectSensors is called in a timer to avoid the “thundering herd”
  problem.
- but in the timer’s runnable any exceptions are not logged - they
  just go to stdout, so fixed that
- and also check if the entity is still managed before trying to
  do connectSensors


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

Branch: refs/heads/master
Commit: a03853e018b106a7a91b23321fc3444799299be7
Parents: f1f412b
Author: Aled Sage <aled.sage@gmail.com>
Authored: Wed May 28 18:53:33 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Fri May 30 10:24:38 2014 +0100

----------------------------------------------------------------------
 .../java/brooklyn/entity/basic/SoftwareProcessImpl.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a03853e0/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
index 0a40405..e2e76a2 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java
@@ -30,6 +30,7 @@ import brooklyn.management.Task;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.collections.MutableSet;
 import brooklyn.util.config.ConfigBag;
+import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.task.DynamicTasks;
 import brooklyn.util.task.Tasks;
 import brooklyn.util.time.CountdownTimer;
@@ -191,7 +192,16 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements
Soft
             Timer timer = new Timer();
             timer.schedule(new TimerTask() {
                 @Override public void run() {
-                    connectSensors();
+                    try {
+                        if (getManagementSupport().isNoLongerManaged()) {
+                            log.debug("Entity {} no longer managed; ignoring scheduled connect
sensors on rebind", SoftwareProcessImpl.this);
+                            return;
+                        }
+                        connectSensors();
+                    } catch (Throwable e) {
+                        log.warn("Problem connecting sensors on rebind of "+SoftwareProcessImpl.this,
e);
+                        Exceptions.propagateIfFatal(e);
+                    }
                 }
             }, delay);
         }


Mime
View raw message