Package org.apache.storm.scheduler.resource.strategies.scheduling

# Class ObjectResourcesItem

java.lang.Object
org.apache.storm.scheduler.resource.strategies.scheduling.ObjectResourcesItem

public class ObjectResourcesItem extends Object
class to keep track of resources on a rack or node.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `NormalizedResourceOffer`
  `availableResources`
  `double`
  `avgResourcePercent`
  Amongst all `availableResources`, this is the average ratio of resource to the total available in group.
  `final String`
  `id`
  `double`
  `minResourcePercent`
  Amongst all `availableResources`, this is the minimum ratio of resource to the total available in group.
  `NormalizedResourceOffer`
  `totalResources`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObjectResourcesItem(String id)`
  `ObjectResourcesItem(String id, NormalizedResourceOffer availableResources, NormalizedResourceOffer totalResources, double minResourcePercent, double avgResourcePercent)`
  `ObjectResourcesItem(ObjectResourcesItem other)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(ObjectResourcesItem other)`
  `String`
  `toString()`

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

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

- ## Field Details

  - ### id

    public final String id

  - ### availableResources

    public NormalizedResourceOffer availableResources

  - ### totalResources

    public NormalizedResourceOffer totalResources

  - ### minResourcePercent

    public double minResourcePercent
    Amongst all `availableResources`, this is the minimum ratio of resource to the total available in group. Note that nodes are grouped into hosts. Hosts into racks. And racks are grouped under the cluster.

    An example of this calculation is in `NodeSorter` where value is calculated by `ObjectResourcesSummary.getAvailableResourcesOverall()` using `NormalizedResourceOffer.calculateMinPercentageUsedBy(NormalizedResourceOffer)`.

  - ### avgResourcePercent

    public double avgResourcePercent
    Amongst all `availableResources`, this is the average ratio of resource to the total available in group. Note that nodes are grouped into hosts, hosts into racks, and racks are grouped under the cluster.

    An example of this calculation is in `NodeSorter` where value is calculated by `ObjectResourcesSummary.getAvailableResourcesOverall()` using `NormalizedResourceOffer.calculateAveragePercentageUsedBy(NormalizedResourceOffer)`.

- ## Constructor Details

  - ### ObjectResourcesItem

    public ObjectResourcesItem(String id)

  - ### ObjectResourcesItem

    public ObjectResourcesItem(ObjectResourcesItem other)

  - ### ObjectResourcesItem

    public ObjectResourcesItem(String id, NormalizedResourceOffer availableResources, NormalizedResourceOffer totalResources, double minResourcePercent, double avgResourcePercent)

- ## Method Details

  - ### add

    public void add(ObjectResourcesItem other)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`