org.apache.storm.scheduler.multitenant

## Class Node

- java.lang.Object
- - org.apache.storm.scheduler.multitenant.Node

-     public class Node
      extends Object

  Represents a single node in the cluster.

- - ### Field Summary

    Fields
    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 Summary

    Constructors
    Constructor and Description
    `Node(String nodeId, Set<Integer> allPorts, boolean isAlive)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### FREE_NODE_COMPARATOR_DEC

          public static final Comparator<Node> FREE_NODE_COMPARATOR_DEC

      Used to sort a list of nodes so the node with the most free slots comes first.

  - ### Constructor Detail

    - #### Node

          public Node(String nodeId,
                      Set<Integer> allPorts,
                      boolean isAlive)

  - ### Method Detail

    - #### countSlotsUsed

          public static int countSlotsUsed(String topId,
                                           Collection<Node> nodes)

    - #### countSlotsUsed

          public static int countSlotsUsed(Collection<Node> nodes)

    - #### countFreeSlotsAlive

          public static int countFreeSlotsAlive(Collection<Node> nodes)

    - #### countTotalSlotsAlive

          public static int countTotalSlotsAlive(Collection<Node> nodes)

    - #### getAllNodesFrom

          public static Map<String,Node> getAllNodesFrom(Cluster cluster)

    - #### getId

          public String getId()

    - #### isAlive

          public boolean isAlive()

    - #### getRunningTopologies

          public Collection<String> 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

          public int totalSlotsUsed(String topId)

    - #### totalSlots

          public int totalSlots()

    - #### freeAllSlots

          public void freeAllSlots(Cluster cluster)

      Free all slots on this node. This will update the Cluster too.

      Parameters:
        `cluster` - the cluster to be updated

    - #### free

          public void free(WorkerSlot ws,
                           Cluster cluster,
                           boolean forceFree)

      Frees a single slot in this node.

      Parameters:
        `ws` - the slot to free
        `cluster` - the cluster to update

    - #### freeTopology

          public void freeTopology(String topId,
                                   Cluster cluster)

      Frees all the slots for a topology.

      Parameters:
        `topId` - the topology to free slots for
        `cluster` - the cluster to update

    - #### assign

          public void assign(String topId,
                             Collection<ExecutorDetails> executors,
                             Cluster cluster)

      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

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2021 The Apache Software Foundation. All rights reserved.