Class RateLimitingFactory

java.lang.Object
org.apache.hadoop.util.RateLimitingFactory

@Private @Unstable public final class RateLimitingFactory extends Object
Factory for Rate Limiting. This should be only place in the code where the guava RateLimiter is imported.
  • Method Details

    • unlimitedRate

      public static RateLimiting unlimitedRate()
      Get the unlimited rate.
      Returns:
      a rate limiter which always has capacity.
    • create

      public static RateLimiting create(int capacity)
      Create an instance. If the rate is 0; return the unlimited rate.
      Parameters:
      capacity - capacity in permits/second.
      Returns:
      limiter restricted to the given capacity.