Class RateLimiter

    • Constructor Detail

      • RateLimiter

        public RateLimiter()
    • Method Detail

      • setMBPerSec

        public abstract void setMBPerSec​(double mbPerSec)
        Sets an updated MB per second rate limit.
      • getMBPerSec

        public abstract double getMBPerSec()
        The current MB per second rate limit.
      • pause

        public abstract long pause​(long bytes)
                            throws IOException
        Pauses, if necessary, to keep the instantaneous IO rate at or below the target.

        Note: the implementation is thread-safe

        the pause time in nano seconds
      • getMinPauseCheckBytes

        public abstract long getMinPauseCheckBytes()
        How many bytes caller should add up itself before invoking pause(long).