brooklyn.entity.basic.AbstractGroup Maven / Gradle / Ivy
Show all versions of brooklyn-core Show documentation
package brooklyn.entity.basic;
import java.util.Collection;
import brooklyn.entity.Entity;
import brooklyn.entity.Group;
import brooklyn.entity.trait.Changeable;
import com.google.common.base.Predicate;
/**
* 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.
*/
public interface AbstractGroup extends Entity, Group, Changeable {
public void setMembers(Collection m);
/**
* Removes any existing members that do not match the given filter, and adds those entities in
* the given collection that match the predicate.
*
* @param mm Entities to test against the filter, and to add
* @param filter Filter for entities that are to be members (or null for "all")
*/
// FIXME Do we really want this method? "setMembers" is a misleading name
public void setMembers(Collection mm, Predicate filter);
}