public final class ThrottlingService extends AbstractThrottlingService<HttpRequest,HttpResponse> implements HttpService
HttpService to throttle incoming requests.| Modifier and Type | Method and Description |
|---|---|
static Function<? super HttpService,ThrottlingService> |
newDecorator(ThrottlingStrategy<HttpRequest> strategy)
Creates a new decorator using the specified
ThrottlingStrategy instance. |
protected HttpResponse |
onFailure(ServiceRequestContext ctx,
HttpRequest 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, shouldCachePathpublic static Function<? super HttpService,ThrottlingService> newDecorator(ThrottlingStrategy<HttpRequest> strategy)
ThrottlingStrategy instance.strategy - The ThrottlingStrategy instance to be usedprotected HttpResponse onFailure(ServiceRequestContext ctx, HttpRequest req, Throwable cause) throws Exception
req is throttled. By default, this method responds with the
HttpStatus.SERVICE_UNAVAILABLE status.onFailure in class AbstractThrottlingService<HttpRequest,HttpResponse>ExceptionCopyright © 2020 LeanCloud. All rights reserved.