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
EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, LOG, 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.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, addGroup, addLocations, addPolicy, clearLocations, clearParent, configure, configure, configure, configure, configure, configure, destroy, emit, emitInternal, equals, finalize, firstLocation, getAllAttributes, getAllConfig, getApplication, getApplicationId, getAttribute, getAttributeByNameParts, getChildren, getConfig, getConfig, getConfig, getConfig, getConfigMap, getCreationTime, getDisplayName, getEffector, getEnrichers, getEntityManager, getEntityType, getEntityTypeName, getExecutionContext, getGroups, getIconUrl, getId, 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, setDisplayName, setManagementContext, setParent, setProxy, subscribe, subscribeToChildren, subscribeToMembers, toMetadataRecord, toString, toStringHelper, unsubscribe, unsubscribe
 

Constructor Detail

AbstractGroupImpl

public AbstractGroupImpl()


 
Method Detail

addMember

log.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


getCurrentSize

public java.lang.Integer getCurrentSize()


getMembers

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


hasMember

public Integer getCurrentSize() {
public boolean hasMember(Entity e)


init

/**
public void init()


removeMember

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


setManagementContext

@Override
public void setManagementContext(ManagementContextInternal managementContext)


setMembers

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


setMembers

if (!(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.