public class DefaultPool extends NodePool
NodePool.NodeAndSlotCounts, NodePool.RoundRobinSlotScheduler
cluster, nodeIdToNode
Constructor and Description |
---|
DefaultPool() |
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.
|
int |
nodesAvailable()
Get the number of available nodes.
|
void |
scheduleAsNeeded(NodePool... lesserPools)
Reschedule any topologies as needed.
|
int |
slotsAvailable()
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.
|
String |
toString() |
getNodeCountIfSlotsWereTaken, init, nodesAvailable, slotsAvailable, takeNodes, takeNodesBySlot
public void addTopology(TopologyDetails td)
NodePool
addTopology
in class NodePool
td
- the topology to addpublic boolean canAdd(TopologyDetails td)
NodePool
public Collection<Node> takeNodes(int nodesNeeded)
NodePool
public int nodesAvailable()
NodePool
nodesAvailable
in class NodePool
public int slotsAvailable()
NodePool
slotsAvailable
in class NodePool
public NodePool.NodeAndSlotCounts getNodeAndSlotCountIfSlotsWereTaken(int slotsNeeded)
NodePool
getNodeAndSlotCountIfSlotsWereTaken
in class NodePool
slotsNeeded
- the number of slots neededpublic Collection<Node> takeNodesBySlots(int slotsNeeded)
NodePool
takeNodesBySlots
in class NodePool
slotsNeeded
- the number of slots that are needed.public void scheduleAsNeeded(NodePool... lesserPools)
NodePool
scheduleAsNeeded
in class NodePool
lesserPools
- pools that may be used to steal nodes from.Copyright © 2023 The Apache Software Foundation. All rights reserved.