Class RemoteRateLimiter.Bucket

java.lang.Object
fr.becpg.repo.entity.remote.RemoteRateLimiter.Bucket
Enclosing class:
RemoteRateLimiter

private static class RemoteRateLimiter.Bucket extends Object

A token bucket. Refill rate is expressed per millisecond, so the shipped 0.1 means 100 requests per second.

  • Field Details

    • tokens

      private double tokens
    • lastRefillMillis

      private long lastRefillMillis
    • lastLoggedMillis

      private long lastLoggedMillis
  • Constructor Details

    • Bucket

      private Bucket()
  • Method Details

    • take

      boolean take(int capacity, double refillRate)
    • lastRefillMillis

      long lastRefillMillis()
    • shouldLog

      boolean shouldLog()