Package io.grpc.rls

Interface Throttler

    • Method Detail

      • shouldThrottle

        boolean shouldThrottle()
        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.

      • registerBackendResponse

        void registerBackendResponse​(boolean throttled)
        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.
        Parameters:
        throttled - specifies whether the request was throttled by the backend.