public class DynamicClusterImpl extends AbstractGroupImpl implements DynamicCluster
DynamicCluster.NodePlacementStrategy, DynamicCluster.ZoneFailureDetector
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
Startable.RestartEffectorBody, Startable.StartEffectorBody, Startable.StopEffectorBody
EntityInternal.FeedSupport
BrooklynObjectInternal.ConfigurationSupportInternal
CHILD_ADDED, CHILD_REMOVED, EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, LOCATION_ADDED, LOCATION_REMOVED, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED
AVAILABILITY_ZONE_NAMES, CLUSTER, CLUSTER_MEMBER, CUSTOM_CHILD_FLAGS, ENABLE_AVAILABILITY_ZONES, ENTITY_QUARANTINED, FACTORY, FAILED_SUB_LOCATIONS, FIRST_MEMBER_SPEC, INITIAL_QUORUM_SIZE, MEMBER_SPEC, NUM_AVAILABILITY_ZONES, QUARANTINE_FAILED_ENTITIES, QUARANTINE_GROUP, REMOVAL_STRATEGY, RESIZE_BY_DELTA, SERVICE_STATE_ACTUAL, SUB_LOCATIONS, ZONE_FAILURE_DETECTOR, ZONE_PLACEMENT_STRATEGY
FIRST, FIRST_MEMBER, GROUP_MEMBERS, MEMBER_DELEGATE_CHILDREN, MEMBER_DELEGATE_NAME_FORMAT, RUNNING_QUORUM_CHECK, UP_QUORUM_CHECK
GROUP_SIZE, MEMBER_ADDED, MEMBER_REMOVED
INITIAL_SIZE
RESTART, SERVICE_UP, START, STOP
REPLACE_MEMBER
Constructor and Description |
---|
DynamicClusterImpl() |
Modifier and Type | Method and Description |
---|---|
Entity |
addNode(Location loc,
java.util.Map<?,?> extraFlags) |
void |
init()
Default entity initialization, just calls
AbstractEntity.initEnrichers() . |
boolean |
removeChild(Entity child)
Removes the specified child
Entity ; its parent will be set to null. |
java.lang.String |
replaceMember(java.lang.String memberId)
Replaces the entity with the given ID, if it is a member.
|
java.lang.Integer |
resize(java.lang.Integer desiredSize)
Grow or shrink this entity to the desired size.
|
java.util.Collection<Entity> |
resizeByDelta(int delta)
Changes the cluster size by the given number.
|
void |
restart()
Restart the entity.
|
void |
setFactory(EntityFactory<?> factory)
Deprecated.
since 0.7.0; use
setMemberSpec(EntitySpec) |
void |
setMemberSpec(EntitySpec<?> memberSpec) |
void |
setRemovalStrategy(com.google.common.base.Function<java.util.Collection<Entity>,Entity> val) |
void |
setZoneFailureDetector(DynamicCluster.ZoneFailureDetector val) |
void |
setZonePlacementStrategy(DynamicCluster.NodePlacementStrategy val) |
void |
start(java.util.Collection<? extends Location> locsO)
Start the entity in the given collection of locations.
|
void |
stop()
Stop the entity.
|
addMember, addMemberChild, addMemberChild, addMemberInternal, getCurrentSize, getMembers, hasMember, removeMember, setManagementContext, setMembers, setMembers
addChild, addChild, addEnricher, addEnricher, addFeed, addGroup, addLocations, addPolicy, addPolicy, addTag, clearLocations, clearParent, config, configure, configure, configure, configure, configure, containsTag, destroy, emit, emitInternal, equals, feeds, firstLocation, getAllAttributes, getAllConfig, getAllConfigBag, getApplication, getApplicationId, getAttribute, getAttributeByNameParts, getChildren, getConfig, getConfig, getConfig, getConfig, getConfigMap, getConfigRaw, getConfigRaw, getCreationTime, getDisplayName, getEffector, getEnrichers, getEntityType, getExecutionContext, getFeedSupport, getGroups, getIconUrl, getLocalConfigBag, getLocations, getManagementContext, getManagementSupport, getMutableEntityType, getParent, getPolicies, getProxy, getProxyIfAvailable, getRebindSupport, getSubscriptionContext, getTags, hashCode, invalidateReferences, invoke, invoke, invoke, modifyAttribute, onManagementBecomingMaster, onManagementNoLongerMaster, onManagementStarted, onManagementStarting, onManagementStopped, refreshInheritedConfig, removeAllEnrichers, removeAllPolicies, removeAttribute, removeEnricher, removeGroup, removeLocations, removePolicy, removeTag, requestPersist, resetProxy, setAttribute, setAttribute, setAttributeWithoutPublishing, setConfig, setConfig, setConfig, setConfig, setConfig, setConfig, setConfigEvenIfOwned, setConfigEvenIfOwned, setDisplayName, setParent, setProxy, subscribe, subscribeToChildren, subscribeToMembers, toMetadataRecord, toString, unsubscribe, unsubscribe
getCatalogItemId, getId, getTagSupport, rebind, setCatalogItemId, tags
setMembers, setMembers
addChild, addChild, addMember, addMemberChild, addMemberChild, getCurrentSize, getMembers, hasMember, removeMember
addEnricher, addEnricher, addFeed, addGroup, addPolicy, addPolicy, addTag, clearParent, containsTag, getApplication, getApplicationId, getAttribute, getChildren, getConfig, getConfig, getConfigRaw, getConfigRaw, getCreationTime, getDisplayName, getEnrichers, getEntityType, getGroups, getIconUrl, getId, getLocations, getParent, getPolicies, getTags, invoke, removeEnricher, removeGroup, removePolicy, removeTag, setParent
getCatalogItemId, getTagSupport, tags
config, setConfig
getCurrentSize
setCatalogItemId
public void init()
AbstractEntity
AbstractEntity.initEnrichers()
.init
in class AbstractGroupImpl
public void setRemovalStrategy(com.google.common.base.Function<java.util.Collection<Entity>,Entity> val)
setRemovalStrategy
in interface DynamicCluster
public void setZonePlacementStrategy(DynamicCluster.NodePlacementStrategy val)
setZonePlacementStrategy
in interface DynamicCluster
public void setZoneFailureDetector(DynamicCluster.ZoneFailureDetector val)
setZoneFailureDetector
in interface DynamicCluster
public void setMemberSpec(EntitySpec<?> memberSpec)
setMemberSpec
in interface DynamicCluster
@Deprecated public void setFactory(EntityFactory<?> factory)
setMemberSpec(EntitySpec)
setFactory
in interface DynamicCluster
public void start(java.util.Collection<? extends Location> locsO)
Startable
Some entities may define custom Effector
implementations which support
a richer set of parameters. See the entity-specific Startable.START
effector declaration.
public void stop()
Startable
Some entities may define custom Effector
implementations which support
a richer set of parameters. See the entity-specific Startable.STOP
effector declaration.
public void restart()
Startable
Some entities may define custom Effector
implementations which support
a richer set of parameters. See the entity-specific Startable.RESTART
effector declaration.
public java.lang.Integer resize(java.lang.Integer desiredSize)
Resizable
public java.lang.String replaceMember(java.lang.String memberId)
First adds a new member, then removes this one.
Note for sub-classes; this method can be called while synchronized on mutex
.
replaceMember
in interface MemberReplaceable
memberId
- entity id of a member to be replacedpublic java.util.Collection<Entity> resizeByDelta(int delta)
mutex
.resizeByDelta
in interface DynamicCluster
delta
- number of nodes to add or remove#grow(int)
public boolean removeChild(Entity child)
Entity
Entity
; its parent will be set to null.removeChild
in interface Entity
removeChild
in class AbstractEntity
public Entity addNode(Location loc, java.util.Map<?,?> extraFlags)
addNode
in interface DynamicCluster