public final class ThrottlingRpcService extends AbstractThrottlingService<RpcRequest,RpcResponse> implements RpcService
Service to throttle incoming requests.| Modifier | Constructor and Description |
|---|---|
protected |
ThrottlingRpcService(RpcService delegate,
ThrottlingStrategy<RpcRequest> strategy)
Creates a new instance that decorates the specified
Service. |
| Modifier and Type | Method and Description |
|---|---|
static Function<? super RpcService,ThrottlingRpcService> |
newDecorator(ThrottlingStrategy<RpcRequest> strategy)
Creates a new decorator using the specified
ThrottlingStrategy instance. |
protected RpcResponse |
onFailure(ServiceRequestContext ctx,
RpcRequest req,
Throwable cause)
Invoked when
req is throttled. |
onSuccess, serveserviceAdded, shouldCachePathas, delegate, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdecorate, decorate, serveas, decorate, serviceAdded, shouldCachePathprotected ThrottlingRpcService(RpcService delegate, ThrottlingStrategy<RpcRequest> strategy)
Service.public static Function<? super RpcService,ThrottlingRpcService> newDecorator(ThrottlingStrategy<RpcRequest> strategy)
ThrottlingStrategy instance.strategy - The ThrottlingStrategy instance to be usedprotected RpcResponse onFailure(ServiceRequestContext ctx, RpcRequest req, Throwable cause) throws Exception
req is throttled. By default, this method responds with a
HttpStatusException with 503 Service Unavailable.onFailure in class AbstractThrottlingService<RpcRequest,RpcResponse>ExceptionCopyright © 2020 LeanCloud. All rights reserved.