org.apache.storm.scheduler.multitenant

## Class FreePool

- java.lang.Object
- - org.apache.storm.scheduler.multitenant.NodePool
  - - org.apache.storm.scheduler.multitenant.FreePool

-     public class FreePool
      extends NodePool

  All of the machines that currently have nothing assigned to them.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.storm.scheduler.multitenant.NodePool

      `NodePool.NodeAndSlotCounts, NodePool.RoundRobinSlotScheduler`

  - ### Field Summary

    - ### Fields inherited from class org.apache.storm.scheduler.multitenant.NodePool

      `cluster, nodeIdToNode`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FreePool()`

  - ### Method Summary

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

    - ### Methods inherited from class org.apache.storm.scheduler.multitenant.NodePool

      `getNodeCountIfSlotsWereTaken, nodesAvailable, slotsAvailable, takeNodes, takeNodesBySlot`

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

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

- - ### Constructor Detail

    - #### FreePool

          public FreePool()

  - ### Method Detail

    - #### init

          public void init(Cluster cluster,
                           Map<String,Node> nodeIdToNode)

      Description copied from class: `NodePool`

      Initialize the pool.

      Overrides:
        `init` in class `NodePool`
      Parameters:
        `cluster` - the cluster
        `nodeIdToNode` - the mapping of node id to nodes

    - #### addTopology

          public void addTopology(TopologyDetails td)

      Description copied from class: `NodePool`

      Add a topology to the pool.

      Specified by:
        `addTopology` in class `NodePool`
      Parameters:
        `td` - the topology to add

    - #### canAdd

          public boolean canAdd(TopologyDetails td)

      Description copied from class: `NodePool`

      Check if this topology can be added to this pool.

      Specified by:
        `canAdd` in class `NodePool`
      Parameters:
        `td` - the topology
      Returns:
        true if it can else false

    - #### takeNodes

          public Collection<Node> takeNodes(int nodesNeeded)

      Description copied from class: `NodePool`

      Take up to nodesNeeded from this pool.

      Specified by:
        `takeNodes` in class `NodePool`
      Parameters:
        `nodesNeeded` - the number of nodes that are needed.
      Returns:
        a Collection of nodes with the removed nodes in it. This may be empty, but should not be null.

    - #### nodesAvailable

          public int nodesAvailable()

      Description copied from class: `NodePool`

      Get the number of available nodes.

      Specified by:
        `nodesAvailable` in class `NodePool`
      Returns:
        the number of nodes that are available to be taken

    - #### slotsAvailable

          public int slotsAvailable()

      Description copied from class: `NodePool`

      Get number of available slots.

      Specified by:
        `slotsAvailable` in class `NodePool`
      Returns:
        the number of slots that are available to be taken

    - #### takeNodesBySlots

          public Collection<Node> takeNodesBySlots(int slotsNeeded)

      Description copied from class: `NodePool`

      Take nodes from this pool that can fulfill possibly up to the slotsNeeded.

      Specified by:
        `takeNodesBySlots` in class `NodePool`
      Parameters:
        `slotsNeeded` - the number of slots that are needed.
      Returns:
        a Collection of nodes with the removed nodes in it. This may be empty, but should not be null.

    - #### getNodeAndSlotCountIfSlotsWereTaken

          public NodePool.NodeAndSlotCounts getNodeAndSlotCountIfSlotsWereTaken(int slotsNeeded)

      Description copied from class: `NodePool`

      Get the number of nodes and slots this would provide to get the slots needed.

      Specified by:
        `getNodeAndSlotCountIfSlotsWereTaken` in class `NodePool`
      Parameters:
        `slotsNeeded` - the number of slots needed
      Returns:
        the number of nodes and slots that would be returned.

    - #### scheduleAsNeeded

          public void scheduleAsNeeded(NodePool... lesserPools)

      Description copied from class: `NodePool`

      Reschedule any topologies as needed.

      Specified by:
        `scheduleAsNeeded` in class `NodePool`
      Parameters:
        `lesserPools` - pools that may be used to steal nodes from.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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