public class NormalizedResourceRequest extends Object implements NormalizedResourcesWithMemory
A resource request with normalized resource names.
| Constructor and Description |
|---|
NormalizedResourceRequest() |
NormalizedResourceRequest(ComponentCommon component,
Map<String,Object> topoConf,
String componentId) |
NormalizedResourceRequest(Map<String,Object> topoConf,
String componentId) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(NormalizedResourceRequest other)
Add the resources in other to this.
|
void |
add(WorkerResources value)
Add the resources from a worker to those in 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() |
public NormalizedResourceRequest(ComponentCommon component, Map<String,Object> topoConf, String componentId)
public NormalizedResourceRequest(Map<String,Object> topoConf, String componentId)
public NormalizedResourceRequest()
public Map<String,Double> toNormalizedMap()
Convert to a map that is used by configuration and the UI.
public static Map<String,Double> addResourceMap(Map<String,Double> resources1, Map<String,Double> resources2)
public static Map<String,Double> subtractResourceMap(Map<String,Double> resource1, Map<String,Double> resource2)
public double getOnHeapMemoryMb()
public void addOnHeap(double onHeap)
public double getOffHeapMemoryMb()
public void addOffHeap(double offHeap)
public void add(NormalizedResourceRequest other)
Add the resources in other to this.
other - the other Request to add to this.public void add(WorkerResources value)
Add the resources from a worker to those in this.
value - the resources on the worker.public double getTotalMemoryMb()
getTotalMemoryMb in interface NormalizedResourcesWithMemorypublic double getTotalCpu()
public NormalizedResources getNormalizedResources()
getNormalizedResources in interface NormalizedResourcesWithMemorypublic void clear()
NormalizedResourcesWithMemorySet all resources to 0.
clear in interface NormalizedResourcesWithMemorypublic boolean areAnyOverZero()
NormalizedResourcesWithMemoryReturn true if any of the resources are > 0.
areAnyOverZero in interface NormalizedResourcesWithMemoryCopyright © 2021 The Apache Software Foundation. All rights reserved.