softwareProcess.restart: even on error, set expected=running

Previously if the restart failed in some way (e.g. an error in the 
launch script or a timeout waiting for serviceUp), we would leave the 
expectedState as “starting”. This meant that serviceUp=false was not
rendered as an error.

Always setting expected=running is better, but is not great. For 
example, if a script fails in restart then we won’t mark the 
entity as onFire if the basic service-up checks still pass. This is
different from the start() behaviour. But then we are doing less than
in start (e.g. in start a script failure could mean that a WAR was not
installed so the simple serviceUp reachability check would not be
sufficient if customize() had failed).

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

Branch: refs/heads/master
Commit: a0418bfb4805c2f1443e2077d9362127e644ff1f
Parents: d08cda6
Author: Aled Sage <aled.s...@gmail.com>
Authored: Fri Mar 25 00:29:51 2016 +0000
Committer: Aled Sage <aled.s...@gmail.com>
Committed: Fri Mar 25 00:29:51 2016 +0000

----------------------------------------------------------------------
 .../base/SoftwareProcessDriverLifecycleEffectorTasks.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a0418bfb/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessDriverLifecycleEffectorTasks.java
----------------------------------------------------------------------
diff --git 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessDriverLifecycleEffectorTasks.java
 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessDriverLifecycleEffectorTasks.java
index cb4149a..1e174c0 100644
--- 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessDriverLifecycleEffectorTasks.java
+++ 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/SoftwareProcessDriverLifecycleEffectorTasks.java
@@ -82,9 +82,12 @@ public class SoftwareProcessDriverLifecycleEffectorTasks 
extends MachineLifecycl
     private class PostRestartTask implements Runnable {
         @Override
         public void run() {
-            postStartCustom();
-            postRestartCustom();
-            ServiceStateLogic.setExpectedState(entity(), Lifecycle.RUNNING);
+            try {
+                postStartCustom();
+                postRestartCustom();
+            } finally {
+                ServiceStateLogic.setExpectedState(entity(), 
Lifecycle.RUNNING);
+            }
         }
     }
     

Reply via email to