Package org.apache.storm.scheduler.resource.normalization

# Class NormalizedResourceRequest

java.lang.Object
org.apache.storm.scheduler.resource.normalization.NormalizedResourceRequest

All Implemented Interfaces:
  `NormalizedResourcesWithMemory`

public class NormalizedResourceRequest extends Object implements NormalizedResourcesWithMemory
A resource request with normalized resource names.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NormalizedResourceRequest()`
  `NormalizedResourceRequest(Map<String,Object> topoConf, String componentId)`
  `NormalizedResourceRequest(ComponentCommon component, Map<String,Object> topoConf, String componentId)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(WorkerResources value)`
  Add the resources from a worker to those in this.
  `void`
  `add(NormalizedResourceRequest other)`
  Add the resources in other to this.
  `void`
  `addOffHeap(double offHeap)`
  `void`
  `addOnHeap(double onHeap)`
  `static Map<String,Double>`
  `addResourceMap(Map<String,Double> resources1, Map<String,Double> resources2)`
  `boolean`
  `areAnyOverZero()`
  Return true if any of the resources are > 0.
  `void`
  `clear()`
  Set all resources to 0.
  `NormalizedResources`
  `getNormalizedResources()`
  `double`
  `getOffHeapMemoryMb()`
  `double`
  `getOnHeapMemoryMb()`
  `double`
  `getTotalCpu()`
  `double`
  `getTotalMemoryMb()`
  `static void`
  `removeNonGenericResources(Map<String,Double> map)`
  `static Map<String,Double>`
  `subtractResourceMap(Map<String,Double> resource1, Map<String,Double> resource2)`
  `Map<String,Double>`
  `toNormalizedMap()`
  Convert to a map that is used by configuration and the UI.
  `String`
  `toString()`

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

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

- ## Constructor Details

  - ### NormalizedResourceRequest

    public NormalizedResourceRequest(ComponentCommon component, Map<String,Object> topoConf, String componentId)

  - ### NormalizedResourceRequest

    public NormalizedResourceRequest(Map<String,Object> topoConf, String componentId)

  - ### NormalizedResourceRequest

    public NormalizedResourceRequest()

- ## Method Details

  - ### toNormalizedMap

    public Map<String,Double> toNormalizedMap()
    Convert to a map that is used by configuration and the UI.
    Returns:
      a map with the key as the resource name and the value the resource amount.

  - ### removeNonGenericResources

    public static void removeNonGenericResources(Map<String,Double> map)

  - ### addResourceMap

    public static Map<String,Double> addResourceMap(Map<String,Double> resources1, Map<String,Double> resources2)

  - ### subtractResourceMap

    public static Map<String,Double> subtractResourceMap(Map<String,Double> resource1, Map<String,Double> resource2)

  - ### getOnHeapMemoryMb

    public double getOnHeapMemoryMb()

  - ### addOnHeap

    public void addOnHeap(double onHeap)

  - ### getOffHeapMemoryMb

    public double getOffHeapMemoryMb()

  - ### addOffHeap

    public void addOffHeap(double offHeap)

  - ### add

    public void add(NormalizedResourceRequest other)
    Add the resources in other to this.
    Parameters:
      `other` - the other Request to add to this.

  - ### add

    public void add(WorkerResources value)
    Add the resources from a worker to those in this.
    Parameters:
      `value` - the resources on the worker.

  - ### getTotalMemoryMb

    public double getTotalMemoryMb()
    Specified by:
      `getTotalMemoryMb` in interface `NormalizedResourcesWithMemory`

  - ### toString

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

  - ### getTotalCpu

    public double getTotalCpu()

  - ### getNormalizedResources

    public NormalizedResources getNormalizedResources()
    Specified by:
      `getNormalizedResources` in interface `NormalizedResourcesWithMemory`

  - ### clear

    public void clear()
    Description copied from interface: `NormalizedResourcesWithMemory`
    Set all resources to 0.
    Specified by:
      `clear` in interface `NormalizedResourcesWithMemory`

  - ### areAnyOverZero

    public boolean areAnyOverZero()
    Description copied from interface: `NormalizedResourcesWithMemory`
    Return true if any of the resources are > 0.
    Specified by:
      `areAnyOverZero` in interface `NormalizedResourcesWithMemory`