Package io.grpc.rls

Class CachingRlsLbClient.HappyThrottler

java.lang.Object
io.grpc.rls.CachingRlsLbClient.HappyThrottler
All Implemented Interfaces:
Throttler
Enclosing class:
CachingRlsLbClient

private static final class CachingRlsLbClient.HappyThrottler extends Object implements Throttler
A Throttler never throttles.
  • Constructor Details

    • HappyThrottler

      private HappyThrottler()
  • Method Details

    • shouldThrottle

      public boolean shouldThrottle()
      Description copied from interface: Throttler
      Checks if a given request should be throttled by the client. This should be called for every request before allowing it to hit the network. If the returned value is true, the request should be aborted immediately (as if it had been throttled by the server).

      This updates internal state and should be called exactly once for each request.

      Specified by:
      shouldThrottle in interface Throttler
    • registerBackendResponse

      public void registerBackendResponse(boolean throttled)
      Description copied from interface: Throttler
      Registers a response received from the backend for a request allowed by shouldThrottle. This should be called for every response received from the backend (i.e., once for each request for which ShouldThrottle returned false). This updates the internal statistics used by shouldThrottle.
      Specified by:
      registerBackendResponse in interface Throttler
      Parameters:
      throttled - specifies whether the request was throttled by the backend.