Tidy SoftwareProcess.preRestart - Fixes restarting of the software process of BrooklynNode - Adds test for BrooklynNode restart
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/32b47a92 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/32b47a92 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/32b47a92 Branch: refs/heads/master Commit: 32b47a927a810de535124e4fd73b9a343e8b4f53 Parents: 8b3ecd7 Author: Aled Sage <[email protected]> Authored: Tue Mar 10 13:46:54 2015 +0000 Committer: Aled Sage <[email protected]> Committed: Thu Mar 26 10:09:40 2015 +0000 ---------------------------------------------------------------------- .../basic/SoftwareProcessDriverLifecycleEffectorTasks.java | 9 ++++----- .../java/brooklyn/entity/basic/SoftwareProcessImpl.java | 9 ++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/32b47a92/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessDriverLifecycleEffectorTasks.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessDriverLifecycleEffectorTasks.java b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessDriverLifecycleEffectorTasks.java index df706fd..a315e84 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessDriverLifecycleEffectorTasks.java +++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessDriverLifecycleEffectorTasks.java @@ -48,12 +48,11 @@ public class SoftwareProcessDriverLifecycleEffectorTasks extends MachineLifecycl public void restart(ConfigBag parameters) { RestartMachineMode isRestartMachine = parameters.get(RestartSoftwareParameters.RESTART_MACHINE_TYPED); - if (isRestartMachine==null) isRestartMachine=RestartMachineMode.AUTO; + if (isRestartMachine==null) + isRestartMachine=RestartMachineMode.AUTO; + if (isRestartMachine==RestartMachineMode.AUTO) + isRestartMachine = getDefaultRestartStopsMachine() ? RestartMachineMode.TRUE : RestartMachineMode.FALSE; - if (isRestartMachine==RestartMachineMode.AUTO) { - isRestartMachine = getDefaultRestartStopsMachine() ? RestartMachineMode.TRUE : RestartMachineMode.FALSE; - } - if (isRestartMachine==RestartMachineMode.TRUE) { log.debug("restart of "+entity()+" requested be applied at machine level"); super.restart(parameters); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/32b47a92/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 f05d0fb..3ce61f1 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java +++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java @@ -176,9 +176,9 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft } } - /** - * Called before driver.start; guarantees the driver will exist, and locations will have been set. - */ + /** + * Called before driver.start; guarantees the driver will exist, and locations will have been set. + */ protected void preStart() { } @@ -271,6 +271,9 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft protected void postStop() { } + /** + * Called before driver.restart; guarantees the driver will exist, and locations will have been set. + */ protected void preRestart() { }
