public static class ServiceStateLogic.ComputeServiceState extends AbstractEnricher implements SensorEventListener<java.lang.Object>
Attributes.SERVICE_STATE_ACTUAL on changes to
Attributes.SERVICE_STATE_EXPECTED, Attributes.SERVICE_PROBLEMS, and Attributes.SERVICE_UP
The default implementation uses computeActualStateWhenExpectedRunning(Map, Boolean) if the last expected transition
was to Lifecycle.RUNNING and
computeActualStateWhenNotExpectedRunning(Map, Boolean, brooklyn.entity.basic.Lifecycle.Transition) otherwise.
If these methods return null, the Attributes.SERVICE_STATE_ACTUAL sensor will be cleared (removed).
Either of these methods can be overridden for custom logic, and that custom enricher can be created using
ServiceStateLogic.newEnricherForServiceState(Class) and added to an entity.
AbstractEntityAdjunct.AdjunctTagSupportBrooklynObject.TagSupportConfigurable.ConfigurationSupportBrooklynObjectInternal.ConfigurationSupportInternal| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_ENRICHER_UNIQUE_TAG |
SUPPRESS_DUPLICATESNOOP| Constructor and Description |
|---|
ServiceStateLogic.ComputeServiceState() |
ServiceStateLogic.ComputeServiceState(java.util.Map<?,?> flags) |
| Modifier and Type | Method and Description |
|---|---|
void |
init()
Called by framework (in new-style instances where spec was used) after configuring etc,
but before a reference to this instance is shared.
|
void |
onEvent(SensorEvent<java.lang.Object> event)
The
SensorEvent handler method. |
void |
setEntity(EntityLocal entity) |
getEnricherType, getRebindSupportconfig, configure, destroy, getAllConfig, getConfig, getConfigMap, getDisplayName, getName, getUniqueTag, isDestroyed, isRunning, setConfig, setDisplayName, setName, tags, toStringgetCatalogItemId, getId, getManagementContext, getTagSupport, rebind, setCatalogItemId, setManagementContextequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllConfig, getConfig, getId, getName, setConfiggetUniqueTag, isDestroyed, isRunninggetCatalogItemId, getDisplayName, getTagSupport, tagsconfigsetCatalogItemIdpublic static final java.lang.String DEFAULT_ENRICHER_UNIQUE_TAG
public ServiceStateLogic.ComputeServiceState()
public ServiceStateLogic.ComputeServiceState(java.util.Map<?,?> flags)
public void init()
AbstractBrooklynObjectTo preserve backwards compatibility for if the instance is constructed directly, one can call the code below, but that means it will be called after references to this policy have been shared with other entities.
if (isLegacyConstruction()) {
init();
}
init in class AbstractBrooklynObjectpublic void setEntity(EntityLocal entity)
setEntity in class AbstractEnricherpublic void onEvent(@Nullable
SensorEvent<java.lang.Object> event)
SensorEventListenerSensorEvent handler method.onEvent in interface SensorEventListener<java.lang.Object>