public class NormalizedResourceRequest extends Object implements NormalizedResourcesWithMemory
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()
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)
other
- the other Request to add to this.public void add(WorkerResources value)
value
- the resources on the worker.public double getTotalMemoryMb()
getTotalMemoryMb
in interface NormalizedResourcesWithMemory
public double getTotalCpu()
public NormalizedResources getNormalizedResources()
getNormalizedResources
in interface NormalizedResourcesWithMemory
public void clear()
NormalizedResourcesWithMemory
clear
in interface NormalizedResourcesWithMemory
public boolean areAnyOverZero()
NormalizedResourcesWithMemory
areAnyOverZero
in interface NormalizedResourcesWithMemory
Copyright © 2023 The Apache Software Foundation. All rights reserved.