Class Node
java.lang.Object
org.apache.storm.scheduler.multitenant.Node
Represents a single node in the cluster.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<Node>Used to sort a list of nodes so the node with the most free slots comes first. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassign(String topId, Collection<ExecutorDetails> executors, Cluster cluster) Assign a free slot on the node to the following topology and executors.static intcountFreeSlotsAlive(Collection<Node> nodes) static intcountSlotsUsed(String topId, Collection<Node> nodes) static intcountSlotsUsed(Collection<Node> nodes) static intcountTotalSlotsAlive(Collection<Node> nodes) booleanvoidfree(WorkerSlot ws, Cluster cluster, boolean forceFree) Frees a single slot in this node.voidfreeAllSlots(Cluster cluster) Free all slots on this node.voidfreeTopology(String topId, Cluster cluster) Frees all the slots for a topology.getAllNodesFrom(Cluster cluster) getId()Get running topologies.inthashCode()booleanisAlive()booleantoString()intintintinttotalSlotsUsed(String topId)
-
Field Details
-
FREE_NODE_COMPARATOR_DEC
Used to sort a list of nodes so the node with the most free slots comes first.
-
-
Constructor Details
-
Node
-
-
Method Details
-
countSlotsUsed
-
countSlotsUsed
-
countFreeSlotsAlive
-
countTotalSlotsAlive
-
getAllNodesFrom
-
getId
-
isAlive
public boolean isAlive() -
getRunningTopologies
Get running topologies.- Returns:
- a collection of the topology ids currently running on this node
-
isTotallyFree
public boolean isTotallyFree() -
totalSlotsFree
public int totalSlotsFree() -
totalSlotsUsed
public int totalSlotsUsed() -
totalSlotsUsed
-
totalSlots
public int totalSlots() -
freeAllSlots
Free all slots on this node. This will update the Cluster too.- Parameters:
cluster- the cluster to be updated
-
free
Frees a single slot in this node.- Parameters:
ws- the slot to freecluster- the cluster to update
-
freeTopology
Frees all the slots for a topology.- Parameters:
topId- the topology to free slots forcluster- the cluster to update
-
assign
Assign a free slot on the node to the following topology and executors. This will update the cluster too.- Parameters:
topId- the topology to assign a free slot to.executors- the executors to run in that slot.cluster- the cluster to be updated
-
equals
-
hashCode
public int hashCode() -
toString
-