Package org.apache.heron.spi.packing
Class Resource
- java.lang.Object
-
- org.apache.heron.spi.packing.Resource
-
public class Resource extends Object
Definition of Resources. Used to form packing structure output.
-
-
Field Summary
Fields Modifier and Type Field Description static ResourceEMPTY_RESOURCE
-
Constructor Summary
Constructors Constructor Description Resource(double cpu, org.apache.heron.common.basics.ByteAmount ram, org.apache.heron.common.basics.ByteAmount disk)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourcecloneWithCpu(double newCpu)ResourcecloneWithDisk(org.apache.heron.common.basics.ByteAmount newDisk)ResourcecloneWithRam(org.apache.heron.common.basics.ByteAmount newRam)doubledivideBy(Resource other)Divides a resource by another resource by dividing the CPU, memory and disk values of the resources.booleanequals(Object obj)doublegetCpu()org.apache.heron.common.basics.ByteAmountgetDisk()org.apache.heron.common.basics.ByteAmountgetRam()inthashCode()Resourceplus(Resource other)Adds a given resource from the current resource.ResourcesubtractAbsolute(Resource other)Subtracts a given resource from the current resource.StringtoString()
-
-
-
Field Detail
-
EMPTY_RESOURCE
public static final Resource EMPTY_RESOURCE
-
-
Method Detail
-
getCpu
public double getCpu()
-
getRam
public org.apache.heron.common.basics.ByteAmount getRam()
-
getDisk
public org.apache.heron.common.basics.ByteAmount getDisk()
-
cloneWithRam
public Resource cloneWithRam(org.apache.heron.common.basics.ByteAmount newRam)
-
cloneWithCpu
public Resource cloneWithCpu(double newCpu)
-
cloneWithDisk
public Resource cloneWithDisk(org.apache.heron.common.basics.ByteAmount newDisk)
-
subtractAbsolute
public Resource subtractAbsolute(Resource other)
Subtracts a given resource from the current resource. The results is never negative.
-
divideBy
public double divideBy(Resource other) throws RuntimeException
Divides a resource by another resource by dividing the CPU, memory and disk values of the resources. It returns the maximum of the three results.- Throws:
RuntimeException
-
-