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 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.
-
-
-
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 interfaceThrottler
-
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 interfaceThrottler
- Parameters:
throttled
- specifies whether the request was throttled by the backend.
-
-