|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.entity.software.MachineLifecycleEffectorTasks
@Beta public abstract class MachineLifecycleEffectorTasks
Default skeleton for start/stop/restart tasks on machines. Knows how to provision machines, making use of ProvidesProvisioningFlags#obtainProvisioningFlags(MachineProvisioningLocation)#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 these):
Field Summary | |
---|---|
static ConfigKey |
LOCATIONS
|
Method Summary | |
---|---|
void
|
attachLifecycleEffectors(Entity entity)
attaches lifecycle effectors (start, restart, stop) to the given entity (post-creation) |
protected EntityInternal
|
entity()
|
protected Location
|
getLocation(java.util.Collection locations)
|
Effector
|
newRestartEffector()
|
EffectorBody
|
newRestartEffectorTask()
as newStartEffectorTask(), calling restart() |
Effector
|
newStartEffector()
returns an effector suitable for setting in a public static final or attaching dynamically; the effector overrides the corresponding effector from Startable with the behaviour in this lifecycle class instance |
EffectorBody
|
newStartEffectorTask()
returns the TaskFactory which supplies the implementation for this effector, calling the relevant method in this class (start(Collection) |
Effector
|
newStopEffector()
|
EffectorBody
|
newStopEffectorTask()
as newStartEffectorTask(), calling stop() |
protected java.util.Map
|
obtainProvisioningFlags(MachineProvisioningLocation location)
|
protected void
|
postStartAtMachineAsync()
|
protected void
|
postStartCustom()
default post-start hooks, can be extended by subclasses, and typically will wait for confirmation of start (the service not set to running until after this); also invoked following a restart |
protected void
|
preStartAtMachineAsync(Supplier machineS)
wraps a call to preStartCustom(MachineLocation), after setting the hostname and address |
protected void
|
preStartCustom(MachineLocation machine)
default pre-start hooks, can be extended by subclasses if needed |
protected void
|
preStopCustom()
can run synchronously (or not) -- caller will submit/queue as needed, and will block on any submitted tasks. |
protected Task
|
provisionAsync(MachineProvisioningLocation location)
returns a queued _task_ which provisions a machine in the given location and returns that machine, so the task can be used as a supplier to subsequent methods |
void
|
restart()
default restart impl, stops processes if possible, then starts the entity again |
void
|
start(java.util.Collection locations)
runs the tasks needed to start, wrapped by setting Attributes#SERVICE_STATE#SERVICE_STATE appropriately |
protected void
|
startInLocation(Location location)
dispatches to the appropriate method(s) to start in the given location |
protected void
|
startInLocations(java.util.Collection locations)
asserts there is a single location and calls startInLocation(Location) with that location |
protected java.lang.String
|
startProcessesAtMachine(Supplier machineS)
|
void
|
stop()
default stop impl, aborts if already stopped, otherwise sets state STOPPING then invokes preStopCustom(), stopProcessesAtMachine(), then finally stopAnyProvisionedMachines() and sets state STOPPED |
protected java.lang.String
|
stopAnyProvisionedMachines()
|
protected java.lang.String
|
stopProcessesAtMachine()
can run synchronously (or not) -- caller will submit/queue as needed, and will block on any submitted tasks. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final ConfigKey LOCATIONS
Method Detail |
---|
public void attachLifecycleEffectors(Entity entity)
protected EntityInternal entity()
protected Location getLocation(@Nullable java.util.Collection locations)
public Effector newRestartEffector()
public EffectorBody newRestartEffectorTask()
public Effector newStartEffector()
public EffectorBody newStartEffectorTask()
public Effector newStopEffector()
public EffectorBody newStopEffectorTask()
protected java.util.Map obtainProvisioningFlags(MachineProvisioningLocation location)
protected void postStartAtMachineAsync()
protected void postStartCustom()
protected void preStartAtMachineAsync(Supplier machineS)
protected void preStartCustom(MachineLocation machine)
protected void preStopCustom()
protected Task provisionAsync(MachineProvisioningLocation location)
public void restart()
public void start(java.util.Collection locations)
protected void startInLocation(Location location)
protected void startInLocations(java.util.Collection locations)
protected java.lang.String startProcessesAtMachine(Supplier machineS)
public void stop()
protected java.lang.String stopAnyProvisionedMachines()
protected java.lang.String stopProcessesAtMachine()
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.