Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/393#discussion_r84833903
  
    --- Diff: 
software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
 ---
    @@ -312,16 +312,36 @@ public void run() {
             } else {
                 DynamicTasks.queue("pre-launch-command", new Runnable() { 
public void run() {
                     ServiceStateLogic.setExpectedState(getEntity(), 
Lifecycle.STARTING);
    -                runPreLaunchCommand();
    +                try {
    +                    runPreLaunchCommand();
    +                } catch (Exception e) {
    +                    ServiceStateLogic.setExpectedState(getEntity(), 
Lifecycle.ON_FIRE);
    +                    throw Exceptions.propagate(e);
    +                }
                 }});
                 DynamicTasks.queue("launch (main)", new Runnable() { public 
void run() {
    -                launch();
    +                try {
    +                    launch();
    +                } catch (Exception e) {
    +                    ServiceStateLogic.setExpectedState(getEntity(), 
Lifecycle.ON_FIRE);
    +                    throw Exceptions.propagate(e);
    +                }
                 }});
                 DynamicTasks.queue("post-launch-command", new Runnable() { 
public void run() {
    -                runPostLaunchCommand();
    +                try {
    +                    runPostLaunchCommand();
    +                } catch (Exception e) {
    +                    ServiceStateLogic.setExpectedState(getEntity(), 
Lifecycle.ON_FIRE);
    +                    throw Exceptions.propagate(e);
    +                }
                 }});
                 DynamicTasks.queue("post-launch", new Runnable() { public void 
run() {
    -                postLaunch();
    +                try {
    +                    postLaunch();
    +                } catch (Exception e) {
    +                    ServiceStateLogic.setExpectedState(getEntity(), 
Lifecycle.ON_FIRE);
    +                    throw Exceptions.propagate(e);
    +                }
    --- End diff --
    
    Still need to do the same for the `doFullStartOnRestart()` case. Suggest 
instead wrapping the `restart` effector as done in 
[`start`](https://github.com/apache/brooklyn-server/blob/master/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java#L353-L363).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to