Brooklyn

brooklyn.policy.ha
[Java] Class ServiceRestarter

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

public class ServiceRestarter
extends AbstractPolicy

attaches to a SoftwareProcess (or anything Startable, emitting ENTITY_FAILED or other configurable sensor), and invokes restart on failure; if there is a subsequent failure within a configurable time interval, or if the restart fails, this gives up and emits ENTITY_RESTART_FAILED


Field Summary
static BasicNotificationSensor ENTITY_RESTART_FAILED

static ConfigKey FAILURE_SENSOR_TO_MONITOR

monitors this sensor, by default ENTITY_FAILED

static ConfigKey FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION

skips retry if a failure re-occurs within this time interval

static ConfigKey SET_ON_FIRE_ON_FAILURE

protected java.util.concurrent.atomic.AtomicReference lastFailureTime

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

ServiceRestarter(java.util.Map flags)

ServiceRestarter(ConfigBag configBag)

ServiceRestarter(Sensor failureSensorToMonitor)

 
Method Summary
protected void onDetectedFailure(SensorEvent event)

protected void onRestartFailed(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_RESTART_FAILED

public static final BasicNotificationSensor ENTITY_RESTART_FAILED


FAILURE_SENSOR_TO_MONITOR

@SetFromFlag("failureSensorToMonitor")
@SuppressWarnings("rawtypes")
public static final ConfigKey FAILURE_SENSOR_TO_MONITOR
monitors this sensor, by default ENTITY_FAILED


FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION

@SetFromFlag("failOnRecurringFailuresInThisDuration")
public static final ConfigKey FAIL_ON_RECURRING_FAILURES_IN_THIS_DURATION
skips retry if a failure re-occurs within this time interval


SET_ON_FIRE_ON_FAILURE

@SetFromFlag("setOnFireOnFailure")
public static final ConfigKey SET_ON_FIRE_ON_FAILURE


lastFailureTime

protected final java.util.concurrent.atomic.AtomicReference lastFailureTime


 
Constructor Detail

ServiceRestarter

public ServiceRestarter()


ServiceRestarter

public ServiceRestarter(java.util.Map flags)


ServiceRestarter

public ServiceRestarter(ConfigBag configBag)


ServiceRestarter

public ServiceRestarter(Sensor failureSensorToMonitor)


 
Method Detail

onDetectedFailure

protected void onDetectedFailure(SensorEvent event)


onRestartFailed

protected void onRestartFailed(java.lang.String msg)


setEntity

public void setEntity(EntityLocal entity) {
public void setEntity(EntityLocal entity)


 

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