public abstract class AbstractGroupImpl extends AbstractEntity implements AbstractGroup
Synchronization model. When changing and reading the group membership, this class uses internal synchronization to ensure atomic operations and the "happens-before" relationship for reads/updates from different threads. Sub-classes should not use this same synchronization mutex when doing expensive operations - e.g. if resizing a cluster, don't block everyone else from asking for the current number of members.
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
EntityInternal.FeedSupport
BrooklynObjectInternal.ConfigurationSupportInternal
CHILD_ADDED, CHILD_REMOVED, EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, LOCATION_ADDED, LOCATION_REMOVED, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED
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 |
---|
AbstractGroupImpl() |
AbstractGroupImpl(java.util.Map flags,
Entity parent)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addMember(Entity member)
Adds the given entity as a member of this group and this group as one of the groups of the child
|
<T extends Entity> |
addMemberChild(EntitySpec<T> spec)
As
Group.addChild(EntitySpec) followed by Group.addMember(Entity) |
<T extends Entity> |
addMemberChild(T child)
As
Group.addChild(Entity) followed by Group.addMember(Entity) |
boolean |
addMemberInternal(Entity member) |
java.lang.Integer |
getCurrentSize() |
java.util.Collection<Entity> |
getMembers()
Return the entities that are members of this group.
|
boolean |
hasMember(Entity e) |
void |
init()
Default entity initialization, just calls
AbstractEntity.initEnrichers() . |
boolean |
removeMember(Entity member)
Returns
true if the group was changed as a result of the call. |
void |
setManagementContext(ManagementContextInternal managementContext) |
void |
setMembers(java.util.Collection<Entity> m) |
void |
setMembers(java.util.Collection<Entity> mm,
com.google.common.base.Predicate<Entity> filter)
Removes any existing members that do not match the given filter, and adds those entities in
the given collection that match the predicate.
|
addChild, addChild, addEnricher, addEnricher, addFeed, addGroup, addLocations, addPolicy, addPolicy, addTag, clearLocations, clearParent, config, 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, onManagementBecomingMaster, onManagementNoLongerMaster, 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
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
config, setConfig
setCatalogItemId
public AbstractGroupImpl()
@Deprecated public AbstractGroupImpl(java.util.Map flags, Entity parent)
public void setManagementContext(ManagementContextInternal managementContext)
setManagementContext
in class AbstractEntity
public void init()
AbstractEntity
AbstractEntity.initEnrichers()
.init
in class AbstractEntity
public boolean addMember(Entity member)
public boolean addMemberInternal(Entity member)
public boolean removeMember(Entity member)
true
if the group was changed as a result of the call.removeMember
in interface Group
public void setMembers(java.util.Collection<Entity> m)
setMembers
in interface AbstractGroup
public void setMembers(java.util.Collection<Entity> mm, com.google.common.base.Predicate<Entity> filter)
AbstractGroup
setMembers
in interface AbstractGroup
mm
- Entities to test against the filter, and to addfilter
- Filter for entities that are to be members (or null for "all")public java.util.Collection<Entity> getMembers()
Group
getMembers
in interface Group
public boolean hasMember(Entity e)
public java.lang.Integer getCurrentSize()
getCurrentSize
in interface Group
public <T extends Entity> T addMemberChild(EntitySpec<T> spec)
Group
Group.addChild(EntitySpec)
followed by Group.addMember(Entity)
addMemberChild
in interface Group
public <T extends Entity> T addMemberChild(T child)
Group
Group.addChild(Entity)
followed by Group.addMember(Entity)
addMemberChild
in interface Group