Class NodePool
java.lang.Object
org.apache.storm.scheduler.multitenant.NodePool
- Direct Known Subclasses:
- DefaultPool,- FreePool,- IsolatedPool
A pool of nodes that can be used to run topologies.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic classPlace executors into slots in a round robin way, taking into account component spreading among different hosts.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract voidAdd a topology to the pool.abstract booleanCheck if this topology can be added to this pool.abstract NodePool.NodeAndSlotCountsgetNodeAndSlotCountIfSlotsWereTaken(int slots) Get the number of nodes and slots this would provide to get the slots needed.static intgetNodeCountIfSlotsWereTaken(int slots, NodePool[] pools) voidInitialize the pool.abstract intGet the number of available nodes.static intnodesAvailable(NodePool[] pools) abstract voidscheduleAsNeeded(NodePool... lesserPools) Reschedule any topologies as needed.abstract intGet number of available slots.static intslotsAvailable(NodePool[] pools) abstract Collection<Node>takeNodes(int nodesNeeded) Take up to nodesNeeded from this pool.static Collection<Node>static Collection<Node>takeNodesBySlot(int slotsNeeded, NodePool[] pools) abstract Collection<Node>takeNodesBySlots(int slotsNeeded) Take nodes from this pool that can fulfill possibly up to the slotsNeeded.
- 
Field Details- 
cluster
- 
nodeIdToNode
 
- 
- 
Constructor Details- 
NodePoolpublic NodePool()
 
- 
- 
Method Details- 
slotsAvailable
- 
slotsAvailablepublic abstract int slotsAvailable()Get number of available slots.- Returns:
- the number of slots that are available to be taken
 
- 
nodesAvailable
- 
nodesAvailablepublic abstract int nodesAvailable()Get the number of available nodes.- Returns:
- the number of nodes that are available to be taken
 
- 
takeNodesBySlot
- 
takeNodes
- 
getNodeCountIfSlotsWereTaken
- 
initInitialize the pool.- Parameters:
- cluster- the cluster
- nodeIdToNode- the mapping of node id to nodes
 
- 
addTopologyAdd a topology to the pool.- Parameters:
- td- the topology to add
 
- 
canAddCheck if this topology can be added to this pool.- Parameters:
- td- the topology
- Returns:
- true if it can else false
 
- 
takeNodesBySlotsTake nodes from this pool that can fulfill possibly up to the slotsNeeded.- Parameters:
- slotsNeeded- the number of slots that are needed.
- Returns:
- a Collection of nodes with the removed nodes in it. This may be empty, but should not be null.
 
- 
getNodeAndSlotCountIfSlotsWereTakenGet the number of nodes and slots this would provide to get the slots needed.- Parameters:
- slots- the number of slots needed
- Returns:
- the number of nodes and slots that would be returned.
 
- 
takeNodesTake up to nodesNeeded from this pool.- Parameters:
- nodesNeeded- the number of nodes that are needed.
- Returns:
- a Collection of nodes with the removed nodes in it. This may be empty, but should not be null.
 
- 
scheduleAsNeededReschedule any topologies as needed.- Parameters:
- lesserPools- pools that may be used to steal nodes from.
 
 
-