Class DefaultLoad

  • All Implemented Interfaces:
    Load

    public class DefaultLoad
    extends java.lang.Object
    implements Load
    Implementation of a load.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultLoad()
      Creates an invalid load.
      DefaultLoad​(long current, long previous)
      Creates a load value from the parameters.
      DefaultLoad​(long current, long previous, long interval)
      Creates a load value from the parameters.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isValid()
      Indicates whether this load was built on valid values.
      long latest()
      Obtain the latest bytes counter viewed on that link.
      long rate()
      Obtain the current observed rate (in bytes/s) on a link.
      static void setPollInterval​(long newPollInterval)
      Sets the poll interval in seconds.
      long time()
      Returns when this value was seen.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefaultLoad

        public DefaultLoad()
        Creates an invalid load.
      • DefaultLoad

        public DefaultLoad​(long current,
                           long previous)
        Creates a load value from the parameters.
        Parameters:
        current - the current value
        previous - the previous value
      • DefaultLoad

        public DefaultLoad​(long current,
                           long previous,
                           long interval)
        Creates a load value from the parameters.
        Parameters:
        current - the current value
        previous - the previous value
        interval - poll interval for this load
    • Method Detail

      • setPollInterval

        public static void setPollInterval​(long newPollInterval)
        Sets the poll interval in seconds. Used solely for the purpose of computing the load.
        Parameters:
        newPollInterval - poll interval duration in seconds
      • rate

        public long rate()
        Description copied from interface: Load
        Obtain the current observed rate (in bytes/s) on a link.
        Specified by:
        rate in interface Load
        Returns:
        long value
      • latest

        public long latest()
        Description copied from interface: Load
        Obtain the latest bytes counter viewed on that link.
        Specified by:
        latest in interface Load
        Returns:
        long value
      • isValid

        public boolean isValid()
        Description copied from interface: Load
        Indicates whether this load was built on valid values.
        Specified by:
        isValid in interface Load
        Returns:
        boolean
      • time

        public long time()
        Description copied from interface: Load
        Returns when this value was seen.
        Specified by:
        time in interface Load
        Returns:
        epoch time
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object