Brooklyn

brooklyn.entity.group
[Java] Class DynamicClusterImpl

java.lang.Object
  brooklyn.entity.basic.AbstractEntity
      brooklyn.entity.basic.AbstractGroupImpl
          brooklyn.entity.group.DynamicClusterImpl
All Implemented Interfaces:
DynamicCluster

public class DynamicClusterImpl
extends AbstractGroupImpl

A cluster of entities that can dynamically increase or decrease the number of entities.


Field Summary
protected java.lang.Object mutex

Mutex for synchronizing during re-size operations.

 
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
DynamicClusterImpl()

 
Method Summary
protected Entity addNode(Location loc)

protected Entity addNode()

protected boolean calculateServiceUp()

protected void cleanupFailedNodes(java.util.Collection failedEntities)

Default impl is to be up when running, and !

protected Entity createNode(Location loc, java.util.Map flags)

protected Entity createNode(java.util.Map flags)

protected void discardNode(Entity entity)

protected java.util.List findSubLocations(Location loc)

protected java.util.Map getCustomChildFlags()

@deprecated since 0.6; use addNode(Location), so can take that location into account when configuring node

protected EntityFactory getFactory()

protected int getInitialQuorumSize()

protected EntitySpec getMemberSpec()

protected Multimap getMembersByLocation()

protected java.util.List getNonFailedSubLocations()

protected Group getQuarantineGroup()

protected Function getRemovalStrategy()

protected ZoneFailureDetector getZoneFailureDetector()

protected NodePlacementStrategy getZonePlacementStrategy()

protected java.util.Collection grow(int delta)

Increases the cluster size by the given number.

protected java.util.Collection growByOne(Location loc)

Increases the cluster size by the given number.

void init()

protected boolean isAvailabilityZoneEnabled()

protected boolean isQuarantineEnabled()

protected Entity pickAndRemoveMember()

@deprecated since 0.6.0; subclasses should instead override pickAndRemoveMembers(int) if they really need to!

protected java.util.List pickAndRemoveMembers(int delta)

protected void quarantineFailedNodes(java.util.Collection failedEntities)

boolean removeChild(Entity child)

java.lang.String replaceMember(java.lang.String memberId)

java.lang.Integer resize(java.lang.Integer desiredSize)

void restart()

void setFactory(EntityFactory factory)

void setMemberSpec(EntitySpec memberSpec)

void setRemovalStrategy(Function val)

void setRemovalStrategy(groovy.lang.Closure val)

void setZoneFailureDetector(ZoneFailureDetector val)

void setZonePlacementStrategy(NodePlacementStrategy val)

protected void shrink(int delta)

Decreases the cluster size by the given number.

void start(java.util.Collection locs)

void stop()

protected void stopAndRemoveNode(Entity member)

protected java.util.Map waitForTasksOnEntityStart(java.util.Map tasks)

 
Methods inherited from class AbstractGroupImpl
addMember, getCurrentSize, getMembers, hasMember, init, removeMember, setManagementContext, setMembers, setMembers
 
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
 

Field Detail

mutex

protected final java.lang.Object mutex
Mutex for synchronizing during re-size operations. Sub-classes should use with great caution, to not introduce deadlocks!


 
Constructor Detail

DynamicClusterImpl

public DynamicClusterImpl()


 
Method Detail

addNode

protected Entity addNode(Location loc)


addNode

protected Entity addNode()


calculateServiceUp

protected boolean calculateServiceUp()


cleanupFailedNodes

protected void cleanupFailedNodes(java.util.Collection failedEntities)
Default impl is to be up when running, and !up otherwise.


createNode

protected Entity createNode( Location loc, java.util.Map flags)


createNode

protected Entity createNode(java.util.Map flags)


discardNode

protected void discardNode(Entity entity)


findSubLocations

protected java.util.List findSubLocations(Location loc)


getCustomChildFlags

protected java.util.Map getCustomChildFlags()
deprecated:
since 0.6; use addNode(Location), so can take that location into account when configuring node


getFactory

protected EntityFactory getFactory()


getInitialQuorumSize

protected int getInitialQuorumSize()


getMemberSpec

protected EntitySpec getMemberSpec()


getMembersByLocation

protected Multimap getMembersByLocation()


getNonFailedSubLocations

protected java.util.List getNonFailedSubLocations()


getQuarantineGroup

protected Group getQuarantineGroup()


getRemovalStrategy

protected Function getRemovalStrategy()


getZoneFailureDetector

protected ZoneFailureDetector getZoneFailureDetector()


getZonePlacementStrategy

protected NodePlacementStrategy getZonePlacementStrategy()


grow

protected java.util.Collection grow(int delta)
Increases the cluster size by the given number. Returns successfully added nodes. Called when synchronized on mutex, so overriders beware!


growByOne

protected java.util.Collection growByOne(Location loc)
Increases the cluster size by the given number. Returns successfully added nodes. Called when synchronized on mutex, so overriders beware!


init

public void init() {
public void init()


isAvailabilityZoneEnabled

protected boolean isAvailabilityZoneEnabled()


isQuarantineEnabled

protected boolean isQuarantineEnabled()


pickAndRemoveMember

protected Entity pickAndRemoveMember()
deprecated:
since 0.6.0; subclasses should instead override pickAndRemoveMembers(int) if they really need to!


pickAndRemoveMembers

protected java.util.List pickAndRemoveMembers(int delta)


quarantineFailedNodes

protected void quarantineFailedNodes(java.util.Collection failedEntities)


removeChild

public boolean removeChild(Entity child)


replaceMember

Entity member = getEntityManager().getEntity(memberId);
public java.lang.String replaceMember(java.lang.String memberId)


resize

synchronized (mutex) {
public java.lang.Integer resize(java.lang.Integer desiredSize)


restart

throw new UnsupportedOperationException();
public void restart()


setFactory

public void setFactory(EntityFactory factory) {
public void setFactory(EntityFactory factory)


setMemberSpec

public void setMemberSpec(EntitySpec memberSpec) {
public void setMemberSpec(EntitySpec memberSpec)


setRemovalStrategy

public void setRemovalStrategy(Function, Entity> val) {
public void setRemovalStrategy(Function val)


setRemovalStrategy

public void setRemovalStrategy(Closure val) {
public void setRemovalStrategy(groovy.lang.Closure val)


setZoneFailureDetector

public void setZoneFailureDetector(ZoneFailureDetector val) {
public void setZoneFailureDetector(ZoneFailureDetector val)


setZonePlacementStrategy

public void setZonePlacementStrategy(NodePlacementStrategy val) {
public void setZonePlacementStrategy(NodePlacementStrategy val)


shrink

protected void shrink(int delta)
Decreases the cluster size by the given number. Called when synchronized on mutex, so overriders beware!


start

public void start(Collection locs) {
public void start(java.util.Collection locs)


stop

setAttribute(SERVICE_STATE, Lifecycle.STOPPING);
public void stop()


stopAndRemoveNode

protected void stopAndRemoveNode(Entity member)


waitForTasksOnEntityStart

protected java.util.Map waitForTasksOnEntityStart(java.util.Map tasks)


 

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