public class DynamicMultiGroupImpl extends DynamicGroupImpl implements DynamicMultiGroup
BrooklynObject.TagSupport
EntityInternal.FeedSupport
CHILD_ADDED, CHILD_REMOVED, EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED
BUCKET_FUNCTION, BUCKET_SPEC, RESCAN, RESCAN_INTERVAL
ENTITY_FILTER, RUNNING
FIRST, FIRST_MEMBER, GROUP_MEMBERS, MEMBER_DELEGATE_CHILDREN, MEMBER_DELEGATE_NAME_FORMAT, RUNNING_QUORUM_CHECK, UP_QUORUM_CHECK
GROUP_SIZE, MEMBER_ADDED, MEMBER_REMOVED
Constructor and Description |
---|
DynamicMultiGroupImpl() |
Modifier and Type | Method and Description |
---|---|
static com.google.common.base.Function<Entity,java.lang.String> |
bucketFromAttribute(AttributeSensor<?> sensor)
Convenience factory method for the common use-case of deriving the bucket directly from a sensor value.
|
static com.google.common.base.Function<Entity,java.lang.String> |
bucketFromAttribute(AttributeSensor<?> sensor,
java.lang.String defaultValue)
Convenience factory method for the common use-case of deriving the bucket directly from a sensor value.
|
void |
distributeEntities()
Distribute entities accepted by the
DynamicGroup.ENTITY_FILTER into uniquely-named
buckets according to the DynamicMultiGroup.BUCKET_FUNCTION . |
void |
init()
Default entity initialization, just calls
AbstractEntity.initEnrichers() . |
void |
rescanEntities()
Rescans all entities to determine whether they match the filter.
|
void |
stop()
Stops this group.
|
addSubscription, addSubscription, entityFilter, onManagementBecomingMaster, onManagementNoLongerMaster, setEntityFilter, setEntityFilter
addMember, addMemberChild, addMemberChild, addMemberInternal, getCurrentSize, getMembers, hasMember, removeMember, setManagementContext, setMembers, setMembers
addChild, addChild, addEnricher, addEnricher, addFeed, addGroup, addLocations, addPolicy, addPolicy, addTag, clearLocations, clearParent, configure, configure, configure, configure, configure, containsTag, destroy, emit, emitInternal, equals, feeds, firstLocation, getAllAttributes, getAllConfig, getAllConfigBag, getApplication, getApplicationId, getAttribute, getAttributeByNameParts, getChildren, getConfig, getConfig, getConfig, getConfig, getConfigMap, getConfigRaw, getConfigRaw, getCreationTime, getDisplayName, getEffector, getEnrichers, getEntityType, getExecutionContext, getFeedSupport, getGroups, getIconUrl, getLocalConfigBag, getLocations, getManagementContext, getManagementSupport, getMutableEntityType, getParent, getPolicies, getProxy, getProxyIfAvailable, getRebindSupport, getSubscriptionContext, getTags, hashCode, invalidateReferences, invoke, invoke, invoke, modifyAttribute, onManagementStarted, onManagementStarting, onManagementStopped, refreshInheritedConfig, removeAllEnrichers, removeAllPolicies, removeAttribute, removeChild, removeEnricher, removeGroup, removeLocations, removePolicy, removeTag, requestPersist, resetProxy, setAttribute, setAttribute, setAttributeWithoutPublishing, setConfig, setConfig, setConfig, setConfig, setConfig, setConfig, setConfigEvenIfOwned, setConfigEvenIfOwned, setDisplayName, setParent, setProxy, subscribe, subscribeToChildren, subscribeToMembers, toMetadataRecord, toString, unsubscribe, unsubscribe
getCatalogItemId, getId, getTagSupport, rebind, setCatalogItemId, tags
addSubscription, addSubscription, entityFilter, setEntityFilter, setEntityFilter
setMembers, setMembers
addChild, addChild, addMember, addMemberChild, addMemberChild, getCurrentSize, getMembers, hasMember, removeMember
addEnricher, addEnricher, addFeed, addGroup, addPolicy, addPolicy, addTag, clearParent, containsTag, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getConfig, getConfigRaw, getConfigRaw, getCreationTime, getDisplayName, getEnrichers, getEntityType, getGroups, getIconUrl, getId, getLocations, getParent, getPolicies, getTags, invoke, removeChild, removeEnricher, removeGroup, removePolicy, removeTag, setParent
getCatalogItemId, getTagSupport, tags
setCatalogItemId
public static com.google.common.base.Function<Entity,java.lang.String> bucketFromAttribute(AttributeSensor<?> sensor, java.lang.String defaultValue)
DynamicMultiGroup.BUCKET_FUNCTION
public static com.google.common.base.Function<Entity,java.lang.String> bucketFromAttribute(AttributeSensor<?> sensor)
DynamicMultiGroup.BUCKET_FUNCTION
public void init()
AbstractEntity
AbstractEntity.initEnrichers()
.init
in class DynamicGroupImpl
public void stop()
DynamicGroup
Does not stop any of its members. De-activates the filter and unsubscribes to entity-updates, so the membership of the group will not change.
stop
in interface DynamicGroup
stop
in class DynamicGroupImpl
public void rescanEntities()
DynamicGroup
rescanEntities
in interface DynamicGroup
rescanEntities
in class DynamicGroupImpl
public void distributeEntities()
DynamicMultiGroup
DynamicGroup.ENTITY_FILTER
into uniquely-named
buckets according to the DynamicMultiGroup.BUCKET_FUNCTION
.
A Group
entity is created for each required bucket and added as a managed child of
this component. Entities for a given bucket are added as members of the corresponding group.
By default BasicGroup
instances will be created for the buckets, however any group
entity can be used instead (e.g. with custom effectors) by specifying the relevant entity
spec via the DynamicMultiGroup.BUCKET_SPEC
config key.
Entities for which the bucket function returns null
are not allocated to any
bucket and are thus effectively excluded. Buckets that become empty following re-evaluation
are removed.
distributeEntities
in interface DynamicMultiGroup
DynamicGroup.ENTITY_FILTER
,
DynamicMultiGroup.BUCKET_FUNCTION
,
#GROUP_SPEC