Class FreePool
- java.lang.Object
-
- org.apache.storm.scheduler.multitenant.NodePool
-
- org.apache.storm.scheduler.multitenant.FreePool
-
public class FreePool extends NodePool
All of the machines that currently have nothing assigned to them.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.storm.scheduler.multitenant.NodePool
NodePool.NodeAndSlotCounts, NodePool.RoundRobinSlotScheduler
-
-
Field Summary
-
Fields inherited from class org.apache.storm.scheduler.multitenant.NodePool
cluster, nodeIdToNode
-
-
Constructor Summary
Constructors Constructor Description FreePool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTopology(TopologyDetails td)Add a topology to the pool.booleancanAdd(TopologyDetails td)Check if this topology can be added to this pool.NodePool.NodeAndSlotCountsgetNodeAndSlotCountIfSlotsWereTaken(int slotsNeeded)Get the number of nodes and slots this would provide to get the slots needed.voidinit(Cluster cluster, Map<String,Node> nodeIdToNode)Initialize the pool.intnodesAvailable()Get the number of available nodes.voidscheduleAsNeeded(NodePool... lesserPools)Reschedule any topologies as needed.intslotsAvailable()Get number of available slots.Collection<Node>takeNodes(int nodesNeeded)Take up to nodesNeeded from this pool.Collection<Node>takeNodesBySlots(int slotsNeeded)Take nodes from this pool that can fulfill possibly up to the slotsNeeded.StringtoString()-
Methods inherited from class org.apache.storm.scheduler.multitenant.NodePool
getNodeCountIfSlotsWereTaken, nodesAvailable, slotsAvailable, takeNodes, takeNodesBySlot
-
-
-
-
Method Detail
-
init
public void init(Cluster cluster, Map<String,Node> nodeIdToNode)
Description copied from class:NodePoolInitialize the pool.
-
addTopology
public void addTopology(TopologyDetails td)
Description copied from class:NodePoolAdd a topology to the pool.- Specified by:
addTopologyin classNodePool- Parameters:
td- the topology to add
-
canAdd
public boolean canAdd(TopologyDetails td)
Description copied from class:NodePoolCheck if this topology can be added to this pool.
-
takeNodes
public Collection<Node> takeNodes(int nodesNeeded)
Description copied from class:NodePoolTake up to nodesNeeded from this pool.
-
nodesAvailable
public int nodesAvailable()
Description copied from class:NodePoolGet the number of available nodes.- Specified by:
nodesAvailablein classNodePool- Returns:
- the number of nodes that are available to be taken
-
slotsAvailable
public int slotsAvailable()
Description copied from class:NodePoolGet number of available slots.- Specified by:
slotsAvailablein classNodePool- Returns:
- the number of slots that are available to be taken
-
takeNodesBySlots
public Collection<Node> takeNodesBySlots(int slotsNeeded)
Description copied from class:NodePoolTake nodes from this pool that can fulfill possibly up to the slotsNeeded.- Specified by:
takeNodesBySlotsin classNodePool- 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.
-
getNodeAndSlotCountIfSlotsWereTaken
public NodePool.NodeAndSlotCounts getNodeAndSlotCountIfSlotsWereTaken(int slotsNeeded)
Description copied from class:NodePoolGet the number of nodes and slots this would provide to get the slots needed.- Specified by:
getNodeAndSlotCountIfSlotsWereTakenin classNodePool- Parameters:
slotsNeeded- the number of slots needed- Returns:
- the number of nodes and slots that would be returned.
-
scheduleAsNeeded
public void scheduleAsNeeded(NodePool... lesserPools)
Description copied from class:NodePoolReschedule any topologies as needed.- Specified by:
scheduleAsNeededin classNodePool- Parameters:
lesserPools- pools that may be used to steal nodes from.
-
-