Class Resource


  • public class Resource
    extends Object
    Definition of Resources. Used to form packing structure output.
    • Field Detail

      • EMPTY_RESOURCE

        public static final Resource EMPTY_RESOURCE
    • Constructor Detail

      • Resource

        public Resource​(double cpu,
                        org.apache.heron.common.basics.ByteAmount ram,
                        org.apache.heron.common.basics.ByteAmount disk)
    • 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.
      • plus

        public Resource plus​(Resource other)
        Adds a given resource from the current resource.
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object