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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(WorkerResources value)Add the resources from a worker to those in this.voidadd(NormalizedResourceRequest other)Add the resources in other to this.voidaddOffHeap(double offHeap)voidaddOnHeap(double onHeap)static Map<String,Double>addResourceMap(Map<String,Double> resources1, Map<String,Double> resources2)booleanareAnyOverZero()Return true if any of the resources are > 0.voidclear()Set all resources to 0.NormalizedResourcesgetNormalizedResources()doublegetOffHeapMemoryMb()doublegetOnHeapMemoryMb()doublegetTotalCpu()doublegetTotalMemoryMb()static voidremoveNonGenericResources(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.StringtoString()
-
-
-
Constructor Detail
-
NormalizedResourceRequest
public NormalizedResourceRequest(ComponentCommon component, Map<String,Object> topoConf, String componentId)
-
NormalizedResourceRequest
public NormalizedResourceRequest(Map<String,Object> topoConf, String componentId)
-
NormalizedResourceRequest
public NormalizedResourceRequest()
-
-
Method Detail
-
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.
-
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:
getTotalMemoryMbin interfaceNormalizedResourcesWithMemory
-
getTotalCpu
public double getTotalCpu()
-
getNormalizedResources
public NormalizedResources getNormalizedResources()
- Specified by:
getNormalizedResourcesin interfaceNormalizedResourcesWithMemory
-
clear
public void clear()
Description copied from interface:NormalizedResourcesWithMemorySet all resources to 0.- Specified by:
clearin interfaceNormalizedResourcesWithMemory
-
areAnyOverZero
public boolean areAnyOverZero()
Description copied from interface:NormalizedResourcesWithMemoryReturn true if any of the resources are > 0.- Specified by:
areAnyOverZeroin interfaceNormalizedResourcesWithMemory
-
-