public class FreePool extends NodePool
All of the machines that currently have nothing assigned to them
NodePool.NodeAndSlotCounts, NodePool.RoundRobinSlotScheduler
_cluster, _nodeIdToNode
Constructor and Description |
---|
FreePool() |
Modifier and Type | Method and Description |
---|---|
void |
addTopology(TopologyDetails td)
Add a topology to the pool
|
boolean |
canAdd(TopologyDetails td)
Check if this topology can be added to this pool
|
NodePool.NodeAndSlotCounts |
getNodeAndSlotCountIfSlotsWereTaken(int slotsNeeded)
Get the number of nodes and slots this would provide to get the slots needed
|
void |
init(Cluster cluster,
Map<String,Node> nodeIdToNode)
Initialize the pool.
|
int |
nodesAvailable() |
void |
scheduleAsNeeded(NodePool... lesserPools)
Reschedule any topologies as needed.
|
int |
slotsAvailable() |
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
|
String |
toString() |
getNodeCountIfSlotsWereTaken, nodesAvailable, slotsAvailable, takeNodes, takeNodesBySlot
public void init(Cluster cluster, Map<String,Node> nodeIdToNode)
NodePool
Initialize the pool.
public void addTopology(TopologyDetails td)
NodePool
Add a topology to the pool
addTopology
in class NodePool
td
- the topology to add.public boolean canAdd(TopologyDetails td)
NodePool
Check if this topology can be added to this pool
public Collection<Node> takeNodes(int nodesNeeded)
NodePool
Take up to nodesNeeded from this pool
public int nodesAvailable()
nodesAvailable
in class NodePool
public int slotsAvailable()
slotsAvailable
in class NodePool
public Collection<Node> takeNodesBySlots(int slotsNeeded)
NodePool
Take nodes from this pool that can fulfill possibly up to the slotsNeeded
takeNodesBySlots
in class NodePool
slotsNeeded
- the number of slots that are needed.public NodePool.NodeAndSlotCounts getNodeAndSlotCountIfSlotsWereTaken(int slotsNeeded)
NodePool
Get the number of nodes and slots this would provide to get the slots needed
getNodeAndSlotCountIfSlotsWereTaken
in class NodePool
slotsNeeded
- the number of slots neededpublic void scheduleAsNeeded(NodePool... lesserPools)
NodePool
Reschedule any topologies as needed.
scheduleAsNeeded
in class NodePool
lesserPools
- pools that may be used to steal nodes from.Copyright © 2019 The Apache Software Foundation. All Rights Reserved.