Brooklyn

brooklyn.entity.basic
[Java] Class AbstractGroupImpl

java.lang.Object
  brooklyn.entity.basic.AbstractEntity
      brooklyn.entity.basic.AbstractGroupImpl
All Implemented Interfaces:
AbstractGroup

public abstract class AbstractGroupImpl
extends AbstractEntity

Represents a group of entities - sub-classes can support dynamically changing membership, ad hoc groupings, etc.

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.


Field Summary
 
Fields inherited from class AbstractEntity
CHILD_ADDED, CHILD_REMOVED, EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED, _subscriptionTracker, managementSupport, tempWorkings
 
Constructor Summary
AbstractGroupImpl()

 
Method Summary
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

java.lang.Object addMemberChild(EntitySpec spec)

java.lang.Object addMemberChild(java.lang.Object child)

java.lang.Integer getCurrentSize()

java.util.Collection getMembers()

boolean hasMember(Entity e)

void init()

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 m)

void setMembers(java.util.Collection mm, Predicate filter)

 
Methods inherited from class AbstractEntity
addChild, addChild, addEnricher, addEnricher, addGroup, addLocations, addPolicy, addPolicy, clearLocations, clearParent, configure, configure, configure, configure, configure, configure, destroy, emit, emitInternal, equals, finalize, firstLocation, getAllAttributes, getAllConfig, getAllConfigBag, getApplication, getApplicationId, getAttribute, getAttributeByNameParts, getChildren, getConfig, getConfig, getConfig, getConfig, getConfigMap, getConfigRaw, getConfigRaw, getCreationTime, getDisplayName, getEffector, getEnrichers, getEntityManager, getEntityType, getEntityTypeName, getExecutionContext, getGroups, getIconUrl, getId, getLocalConfigBag, getLocations, getManagementContext, getManagementSupport, getMutableEntityType, getParent, getPolicies, getProxy, getProxyIfAvailable, getRebindSupport, getSubscriptionContext, getSubscriptionTracker, hashCode, init, invalidateReferences, invoke, invoke, invoke, isLegacyConstruction, onManagementBecomingMaster, onManagementNoLongerMaster, onManagementStarted, onManagementStarting, onManagementStopped, refreshInheritedConfig, removeAllEnrichers, removeAllPolicies, removeAttribute, removeChild, removeEnricher, removeLocations, removePolicy, setApplication, setAttribute, setAttribute, setAttributeWithoutPublishing, setConfig, setConfig, setConfig, setConfig, setConfig, setConfig, setConfigEvenIfOwned, setConfigEvenIfOwned, setConfigIfValNonNull, setConfigIfValNonNull, setDefaultDisplayName, setDisplayName, setManagementContext, setParent, setProxy, subscribe, subscribeToChildren, subscribeToMembers, toMetadataRecord, toString, toStringHelper, unsubscribe, unsubscribe
 

Constructor Detail

AbstractGroupImpl

public AbstractGroupImpl()


 
Method Detail

addMember

@java.lang.Overridelog.debug("Group {} got new member {}", this, member);
public 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


addMemberChild

@java.lang.Overridepublic  T addMemberChild(T child) {
public java.lang.Object addMemberChild(EntitySpec spec)


addMemberChild

@java.lang.Override
public java.lang.Object addMemberChild(java.lang.Object child)


getCurrentSize

@java.lang.Overridepublic  T addMemberChild(EntitySpec spec) {
public java.lang.Integer getCurrentSize()


getMembers

@java.lang.Overridepublic boolean hasMember(Entity e) {
public java.util.Collection getMembers()


hasMember

@java.lang.Overridepublic Integer getCurrentSize() {
public boolean hasMember(Entity e)


init

@java.lang.Override/**
public void init()


removeMember

@java.lang.Overrideemit(MEMBER_REMOVED, member);
public boolean removeMember(Entity member)
Returns true if the group was changed as a result of the call.


setManagementContext

@java.lang.Override
public void setManagementContext(ManagementContextInternal managementContext)


setMembers

@java.lang.Overridepublic void setMembers(Collection mm, Predicate filter) {
public void setMembers(java.util.Collection m)


setMembers

@java.lang.Overrideif (!(mm.contains(m) && (filter==null || filter.apply(m))))
public void setMembers(java.util.Collection mm, Predicate filter)


 

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