Brooklyn

brooklyn.policy.ha
[Java] Class ServiceReplacer

java.lang.Object
  brooklyn.policy.basic.AbstractEntityAdjunct
      brooklyn.policy.basic.AbstractPolicy
          brooklyn.policy.ha.ServiceReplacer

public class ServiceReplacer
extends AbstractPolicy

attaches to a DynamicCluster and replaces a failed member in response to HASensors.ENTITY_FAILED or other sensor; if this fails, it sets the Cluster state to on-fire


Field Summary
static BasicNotificationSensor ENTITY_REPLACEMENT_FAILED

static ConfigKey FAILURE_SENSOR_TO_MONITOR

monitors this sensor, by default ENTITY_RESTART_FAILED

static ConfigKey FAIL_ON_NUM_RECURRING_FAILURES

skips replace if replacement has failed this many times failure re-occurs within this time interval

static ConfigKey FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION

skips replace if replacement has failed this many times failure re-occurs within this time interval

static ConfigKey SET_ON_FIRE_ON_FAILURE

static ConfigKey TICKER

protected java.util.List consecutiveReplacementFailureTimes

 
Fields inherited from class AbstractPolicy
policyStatus, suspended
 
Fields inherited from class AbstractEntityAdjunct
_subscriptionTracker, adjunctType, configsInternal, entity, execution, id, leftoverProperties, name
 
Constructor Summary
ServiceReplacer()

ServiceReplacer(java.util.Map flags)

ServiceReplacer(ConfigBag configBag)

ServiceReplacer(Sensor failureSensorToMonitor)

 
Method Summary
protected long currentTimeMillis()

protected void onDetectedFailure(SensorEvent event)

protected void onReplacementFailed(java.lang.String msg)

void setEntity(EntityLocal entity)

 
Methods inherited from class AbstractPolicy
destroy, getPolicyType, getRebindSupport, isRunning, isSuspended, resume, suspend, toString
 
Methods inherited from class AbstractEntityAdjunct
check, configure, configure, destroy, doReconfigureConfig, getAdjunctType, getAllConfig, getAllSubscriptions, getConfig, getConfigMap, getId, getManagementContext, getName, getSubscriptionTracker, init, isDestroyed, isLegacyConstruction, isRunning, setConfig, setEntity, setId, setManagementContext, setName, subscribe, subscribeToChildren, subscribeToMembers, toString, unsubscribe, unsubscribe
 

Field Detail

ENTITY_REPLACEMENT_FAILED

public static final BasicNotificationSensor ENTITY_REPLACEMENT_FAILED


FAILURE_SENSOR_TO_MONITOR

@SuppressWarnings("rawtypes")
public static final ConfigKey FAILURE_SENSOR_TO_MONITOR = new BasicConfigKey(Sensor.class, "failureSensorToMonitor", "", ServiceRestarter.ENTITY_RESTART_FAILED);
public static final ConfigKey FAILURE_SENSOR_TO_MONITOR
monitors this sensor, by default ENTITY_RESTART_FAILED


FAIL_ON_NUM_RECURRING_FAILURES

public static final ConfigKey FAIL_ON_NUM_RECURRING_FAILURES = ConfigKeys.newIntegerConfigKey(
public static final ConfigKey FAIL_ON_NUM_RECURRING_FAILURES
skips replace if replacement has failed this many times failure re-occurs within this time interval


FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION

public static final ConfigKey FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION = ConfigKeys.newLongConfigKey(
public static final ConfigKey FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION
skips replace if replacement has failed this many times failure re-occurs within this time interval


SET_ON_FIRE_ON_FAILURE

public static final ConfigKey SET_ON_FIRE_ON_FAILURE = ConfigKeys.newBooleanConfigKey("setOnFireOnFailure", "", true);
public static final ConfigKey SET_ON_FIRE_ON_FAILURE


TICKER

public static final ConfigKey TICKER = ConfigKeys.newConfigKey(Ticker.class,
public static final ConfigKey TICKER


consecutiveReplacementFailureTimes

protected final java.util.List consecutiveReplacementFailureTimes


 
Constructor Detail

ServiceReplacer

public ServiceReplacer()


ServiceReplacer

public ServiceReplacer(java.util.Map flags)


ServiceReplacer

public ServiceReplacer(ConfigBag configBag)


ServiceReplacer

public ServiceReplacer(Sensor failureSensorToMonitor)


 
Method Detail

currentTimeMillis

protected long currentTimeMillis()


onDetectedFailure

protected void onDetectedFailure(SensorEvent event)


onReplacementFailed

protected void onReplacementFailed(java.lang.String msg)


setEntity

checkArgument(entity instanceof DynamicCluster, "Replacer must take a DynamicCluster, not %s", entity);
public void setEntity(EntityLocal entity)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.