public class DefaultRecoveryPlanManager extends java.lang.Object implements PlanManager
DefaultRecoveryPlanManager
enables monitoring and management of recovery plan.
This is an implementation of PlanManager
that performs task recovery using dynamically generated
Plan
. DefaultRecoveryPlanManager
tracks currently failed (permanent) and stopped (transient) tasks,
generates a new DefaultRecoveryStep
for them and adds them to the recovery Plan, if not already added.
Modifier and Type | Field and Description |
---|---|
protected ConfigStore<ServiceSpec> |
configStore |
static java.lang.String |
DEFAULT_RECOVERY_PHASE_NAME |
static java.lang.String |
DEFAULT_RECOVERY_PLAN_NAME |
protected FailureMonitor |
failureMonitor |
protected LaunchConstrainer |
launchConstrainer |
protected Logger |
logger |
protected Plan |
plan |
protected java.lang.Object |
planLock |
protected StateStore |
stateStore |
Constructor and Description |
---|
DefaultRecoveryPlanManager(StateStore stateStore,
ConfigStore<ServiceSpec> configStore,
java.util.Set<java.lang.String> recoverableTaskNames,
LaunchConstrainer launchConstrainer,
FailureMonitor failureMonitor) |
DefaultRecoveryPlanManager(StateStore stateStore,
ConfigStore<ServiceSpec> configStore,
java.util.Set<java.lang.String> recoverableTaskNames,
LaunchConstrainer launchConstrainer,
FailureMonitor failureMonitor,
java.util.List<RecoveryPlanOverrider> overrideRecoveryManagers) |
Modifier and Type | Method and Description |
---|---|
(package private) java.util.List<Phase> |
createPhases(java.util.Collection<PodInstanceRequirement> podInstanceRequirements) |
(package private) Step |
createStep(PodInstanceRequirement podInstanceRequirement) |
java.util.Collection<? extends Step> |
getCandidates(java.util.Collection<PodInstanceRequirement> dirtyAssets)
Determines the next
Step s that should be considered for scheduling. |
java.util.Set<PodInstanceRequirement> |
getDirtyAssets()
Returns a
Set of assets that are dirty, i.e. |
Plan |
getPlan() |
protected void |
setPlan(Plan plan) |
void |
update(Protos.TaskStatus status)
Updates the recovery plan if necessary.
|
protected void |
updatePlan(java.util.Collection<PodInstanceRequirement> dirtyAssets) |
public static final java.lang.String DEFAULT_RECOVERY_PLAN_NAME
public static final java.lang.String DEFAULT_RECOVERY_PHASE_NAME
protected final Logger logger
protected final ConfigStore<ServiceSpec> configStore
protected volatile Plan plan
protected final StateStore stateStore
protected final FailureMonitor failureMonitor
protected final LaunchConstrainer launchConstrainer
protected final java.lang.Object planLock
public DefaultRecoveryPlanManager(StateStore stateStore, ConfigStore<ServiceSpec> configStore, java.util.Set<java.lang.String> recoverableTaskNames, LaunchConstrainer launchConstrainer, FailureMonitor failureMonitor)
public DefaultRecoveryPlanManager(StateStore stateStore, ConfigStore<ServiceSpec> configStore, java.util.Set<java.lang.String> recoverableTaskNames, LaunchConstrainer launchConstrainer, FailureMonitor failureMonitor, java.util.List<RecoveryPlanOverrider> overrideRecoveryManagers)
public Plan getPlan()
getPlan
in interface PlanManager
protected void setPlan(Plan plan)
public java.util.Collection<? extends Step> getCandidates(java.util.Collection<PodInstanceRequirement> dirtyAssets)
PlanManager
Step
s that should be considered for scheduling. Step
s that are being selected
by other PlanManager
s are provided as dirtyAssets
as a hint to this PlanManager
to assist
with scheduling.getCandidates
in interface PlanManager
dirtyAssets
- Other Step
s/assets that are already claimed for scheduling elsewhereStep
s that can be scheduled or an empty Collection when there is no Step
to
schedule, which may happen if for example all incomplete Step
s are already being worked on by
other PlanManager
spublic void update(Protos.TaskStatus status)
1. Updates existing steps. 2. If the needs recovery and doesn't yet have a step in the plan, removes any COMPLETED steps for this task (at most one step for a given task can exist) and creates a new PENDING step.
update
in interface PlanManager
status
- task statusprotected void updatePlan(java.util.Collection<PodInstanceRequirement> dirtyAssets)
java.util.List<Phase> createPhases(java.util.Collection<PodInstanceRequirement> podInstanceRequirements)
Step createStep(PodInstanceRequirement podInstanceRequirement)
public java.util.Set<PodInstanceRequirement> getDirtyAssets()
PlanManager
Set
of assets that are dirty, i.e. being worked upon by the Plan
that this
PlanManager
is working on.getDirtyAssets
in interface PlanManager
Set
containing assets that are dirty