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.
AbstractEntity.BasicConfigurationSupport, AbstractEntity.BasicEnricherSupport, AbstractEntity.BasicGroupSupport, AbstractEntity.BasicPolicySupport, AbstractEntity.BasicSensorSupport, AbstractEntity.BasicSubscriptionSupport
Entity.AdjunctSupport<T extends EntityAdjunct>, Entity.EnricherSupport, Entity.GroupSupport, Entity.PolicySupport, Entity.SensorSupport
BrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupport
Configurable.ConfigurationSupport
EntityInternal.EnricherSupportInternal, EntityInternal.EntitySubscriptionSupportInternal, EntityInternal.FeedSupport, EntityInternal.GroupSupportInternal, EntityInternal.PolicySupportInternal, EntityInternal.SensorSupportInternal
BrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternal
APPLICATION_ID, CATALOG_ID, CHILD_ADDED, CHILD_REMOVED, CONFIG_KEY_ADDED, CONFIG_KEY_REMOVED, DEFAULT_DISPLAY_NAME, EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, ENTITY_ID, GROUP_ADDED, GROUP_REMOVED, LOCATION_ADDED, LOCATION_REMOVED, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED
FIRST, 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() |
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 sets ID sensors and 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,
<any> 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, addFeed, addLocations, addLocationsWithoutPublishing, clearLocations, clearParent, config, configure, configure, destroy, enrichers, equals, feeds, firstLocation, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getConfig, getCreationTime, getDisplayName, getEffector, getEntityType, getExecutionContext, getIconUrl, getLocations, getManagementContext, getManagementSupport, getMutableEntityType, getParent, getProxy, getProxyIfAvailable, getRebindSupport, groups, hashCode, invalidateReferences, invoke, invoke, invoke, onManagementBecomingMaster, onManagementNoLongerMaster, onManagementStarted, onManagementStarting, onManagementStopped, policies, relations, removeChild, removeLocations, requestPersist, resetProxy, sensors, setConfigEvenIfOwned, setConfigEvenIfOwned, setDisplayName, setParent, setProxy, subscriptions, toMetadataRecord, toString
addSearchPath, getCatalogItemId, getCatalogItemIdSearchPath, getId, rebind, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemId, tags
getFirst
addFeed, clearParent, enrichers, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getCreationTime, getDisplayName, getEntityType, getIconUrl, getId, getLocations, getParent, groups, invoke, policies, relations, removeChild, sensors, setDisplayName, setParent
getCatalogItemId, getCatalogItemIdSearchPath, subscriptions, tags
config, getConfig
addSearchPath, setCatalogItemId, setCatalogItemIdAndSearchPath, stackCatalogItemId
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, <any> 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