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 Resource
EMPTY_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 Resource
cloneWithCpu(double newCpu)
Resource
cloneWithDisk(org.apache.heron.common.basics.ByteAmount newDisk)
Resource
cloneWithRam(org.apache.heron.common.basics.ByteAmount newRam)
double
divideBy(Resource other)
Divides a resource by another resource by dividing the CPU, memory and disk values of the resources.boolean
equals(Object obj)
double
getCpu()
org.apache.heron.common.basics.ByteAmount
getDisk()
org.apache.heron.common.basics.ByteAmount
getRam()
int
hashCode()
Resource
plus(Resource other)
Adds a given resource from the current resource.Resource
subtractAbsolute(Resource other)
Subtracts a given resource from the current resource.String
toString()
-
-
-
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
-
-