Package io.grpc.rls

Class CachingRlsLbClient.HappyThrottler

  • All Implemented Interfaces:
    Throttler
    Enclosing class:
    CachingRlsLbClient

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

      Constructors 
      Modifier Constructor Description
      private HappyThrottler()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void registerBackendResponse​(boolean throttled)
      Registers a response received from the backend for a request allowed by shouldThrottle.
      boolean shouldThrottle()
      Checks if a given request should be throttled by the client.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HappyThrottler

        private HappyThrottler()
    • Method Detail

      • 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.