public class Node extends Object
Modifier and Type | Field and Description |
---|---|
static Comparator<Node> |
FREE_NODE_COMPARATOR_DEC
Used to sort a list of nodes so the node with the most free slots comes
first.
|
Constructor and Description |
---|
Node(String nodeId,
Set<Integer> allPorts,
boolean isAlive) |
Modifier and Type | Method and Description |
---|---|
void |
assign(String topId,
Collection<ExecutorDetails> executors,
Cluster cluster)
Assign a free slot on the node to the following topology and executors.
|
static int |
countFreeSlotsAlive(Collection<Node> nodes) |
static int |
countSlotsUsed(Collection<Node> nodes) |
static int |
countSlotsUsed(String topId,
Collection<Node> nodes) |
static int |
countTotalSlotsAlive(Collection<Node> nodes) |
boolean |
equals(Object other) |
void |
free(WorkerSlot ws,
Cluster cluster,
boolean forceFree)
Frees a single slot in this node.
|
void |
freeAllSlots(Cluster cluster)
Free all slots on this node.
|
void |
freeTopology(String topId,
Cluster cluster)
Frees all the slots for a topology.
|
static Map<String,Node> |
getAllNodesFrom(Cluster cluster) |
String |
getId() |
Collection<String> |
getRunningTopologies()
Get running topologies.
|
int |
hashCode() |
boolean |
isAlive() |
boolean |
isTotallyFree() |
String |
toString() |
int |
totalSlots() |
int |
totalSlotsFree() |
int |
totalSlotsUsed() |
int |
totalSlotsUsed(String topId) |
public static final Comparator<Node> FREE_NODE_COMPARATOR_DEC
public static int countSlotsUsed(String topId, Collection<Node> nodes)
public static int countSlotsUsed(Collection<Node> nodes)
public static int countFreeSlotsAlive(Collection<Node> nodes)
public static int countTotalSlotsAlive(Collection<Node> nodes)
public String getId()
public boolean isAlive()
public Collection<String> getRunningTopologies()
public boolean isTotallyFree()
public int totalSlotsFree()
public int totalSlotsUsed()
public int totalSlotsUsed(String topId)
public int totalSlots()
public void freeAllSlots(Cluster cluster)
cluster
- the cluster to be updatedpublic void free(WorkerSlot ws, Cluster cluster, boolean forceFree)
ws
- the slot to freecluster
- the cluster to updatepublic void freeTopology(String topId, Cluster cluster)
topId
- the topology to free slots forcluster
- the cluster to updatepublic void assign(String topId, Collection<ExecutorDetails> executors, Cluster cluster)
topId
- the topology to assign a free slot to.executors
- the executors to run in that slot.cluster
- the cluster to be updatedCopyright © 2023 The Apache Software Foundation. All rights reserved.