public abstract class MachineLifecycleEffectorTasks
extends java.lang.Object
 Knows how to provision machines, making use of ProvidesProvisioningFlags.obtainProvisioningFlags(MachineProvisioningLocation),
 and provides hooks for injecting behaviour at common places.
 
Methods are designed for overriding, with the convention that *Async methods should queue (and not block). The following methods are commonly overridden (and you can safely queue tasks, block, or return immediately in them):
#startProcessesAtMachine(Supplier) (required)
  stopProcessesAtMachine() (required, but can be left blank if you assume the VM will be destroyed)
  preStartCustom(MachineLocation)
  postStartCustom()
  preStopCustom()
  postStopCustom()
 Attributes.SERVICE_STATE sensor.| Modifier and Type | Class and Description | 
|---|---|
| static class  | MachineLifecycleEffectorTasks.StopMachineDetails<T> | 
| Modifier and Type | Field and Description | 
|---|---|
| static ConfigKey<java.util.Collection<? extends Location>> | LOCATIONS | 
| static ConfigKey<java.lang.Boolean> | ON_BOX_BASE_DIR_RESOLVED | 
| static ConfigKey<Duration> | STOP_PROCESS_TIMEOUT | 
| Constructor and Description | 
|---|
| MachineLifecycleEffectorTasks() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | attachLifecycleEffectors(Entity entity)Attaches lifecycle effectors (start, restart, stop) to the given entity post-creation. | 
| static boolean | canStop(SoftwareProcess.StopSoftwareParameters.StopMode stopMode,
       Entity entity) | 
| static SoftwareProcess.StopSoftwareParameters.StopMode | getStopMachineMode(ConfigBag parameters) | 
| Effector<java.lang.Void> | newRestartEffector() | 
| EffectorBody<java.lang.Void> | newRestartEffectorTask()Calls  restart(ConfigBag). | 
| Effector<java.lang.Void> | newStartEffector()Return an effector suitable for setting in a  public static finalor attaching dynamically. | 
| EffectorBody<java.lang.Void> | newStartEffectorTask()Returns the  EffectorBodywhich supplies the implementation for the start effector. | 
| Effector<java.lang.Void> | newStopEffector() | 
| EffectorBody<java.lang.Void> | newStopEffectorTask()Calls  stop(ConfigBag). | 
| Effector<java.lang.Void> | newSuspendEffector() | 
| EffectorBody<java.lang.Void> | newSuspendEffectorTask()Calls  suspend(ConfigBag). | 
| static java.lang.String | resolveOnBoxDir(EntityInternal entity,
               MachineLocation machine)Resolves the on-box dir. | 
| void | restart(ConfigBag parameters)Default restart implementation for an entity. | 
| void | start(java.util.Collection<? extends Location> locations)runs the tasks needed to start, wrapped by setting  Attributes.SERVICE_STATE_EXPECTEDappropriately | 
| void | stop(ConfigBag parameters)Default stop implementation for an entity. | 
| void | suspend(ConfigBag parameters)As  stop(org.apache.brooklyn.util.core.config.ConfigBag)but callingsuspendAnyProvisionedMachines()rather thanstopAnyProvisionedMachines(). | 
public static final ConfigKey<java.lang.Boolean> ON_BOX_BASE_DIR_RESOLVED
public void attachLifecycleEffectors(Entity entity)
public Effector<java.lang.Void> newStartEffector()
public static final or attaching dynamically.
 
 The effector overrides the corresponding effector from Startable with
 the behaviour in this lifecycle class instance.
public Effector<java.lang.Void> newRestartEffector()
#newStartEffector()}public Effector<java.lang.Void> newStopEffector()
#newStartEffector()}public Effector<java.lang.Void> newSuspendEffector()
#newStartEffector()}public EffectorBody<java.lang.Void> newStartEffectorTask()
EffectorBody which supplies the implementation for the start effector.
 
 Calls start(Collection) in this class.
public EffectorBody<java.lang.Void> newRestartEffectorTask()
restart(ConfigBag).#newStartEffectorTask()}public EffectorBody<java.lang.Void> newStopEffectorTask()
stop(ConfigBag).#newStartEffectorTask()}public EffectorBody<java.lang.Void> newSuspendEffectorTask()
suspend(ConfigBag).#newStartEffectorTask()}public void start(java.util.Collection<? extends Location> locations)
Attributes.SERVICE_STATE_EXPECTED appropriatelypublic static java.lang.String resolveOnBoxDir(EntityInternal entity, MachineLocation machine)
Initialize and pre-create the right onbox working dir, if an ssh machine location. Logs a warning if not.
public void restart(ConfigBag parameters)
Stops processes if possible, then starts the entity again.
public void stop(ConfigBag parameters)
 Aborts if already stopped, otherwise sets state Lifecycle.STOPPING then
 invokes preStopCustom(), stopProcessesAtMachine(), then finally
 stopAnyProvisionedMachines() and sets state Lifecycle.STOPPED.
 If no errors were encountered call postStopCustom() at the end.
public void suspend(ConfigBag parameters)
stop(org.apache.brooklyn.util.core.config.ConfigBag) but calling suspendAnyProvisionedMachines() rather than
 stopAnyProvisionedMachines().public static SoftwareProcess.StopSoftwareParameters.StopMode getStopMachineMode(ConfigBag parameters)
public static boolean canStop(SoftwareProcess.StopSoftwareParameters.StopMode stopMode, Entity entity)