Class GuavaRateLimiter

    • Constructor Detail

      • GuavaRateLimiter

        public GuavaRateLimiter​(long initialRate)
        Constructor
        Parameters:
        initialRate - Count of permits which should be made available per second. A non-positive rate is taken to indicate there should be no limitation on rate.
    • Method Detail

      • getRate

        public long getRate()
        Description copied from interface: RateLimiter
        Get current QPS of the rate limiter, with a non-positive rate indicating no limit.
        Specified by:
        getRate in interface RateLimiter
      • setRate

        public void setRate​(long newRate)
        Change the rate at which permits are made available.
        Parameters:
        newRate - Count of permits which should be made available per second. A non-positive rate is taken to indicate that there should be no limitation on rate.
      • acquire

        public void acquire​(long permits)
        Description copied from interface: RateLimiter
        Sleep until the specified number of queries are available.
        Specified by:
        acquire in interface RateLimiter