public class ThrottlingHttpService extends ThrottlingService<HttpRequest,HttpResponse>
Service
to throttle incoming requests.Modifier | Constructor and Description |
---|---|
protected |
ThrottlingHttpService(Service<HttpRequest,HttpResponse> delegate,
ThrottlingStrategy<HttpRequest> strategy)
Creates a new instance that decorates the specified
Service . |
Modifier and Type | Method and Description |
---|---|
static Function<Service<HttpRequest,HttpResponse>,ThrottlingHttpService> |
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, serve
as, delegate, serviceAdded, toString
protected ThrottlingHttpService(Service<HttpRequest,HttpResponse> delegate, ThrottlingStrategy<HttpRequest> strategy)
Service
.public static Function<Service<HttpRequest,HttpResponse>,ThrottlingHttpService> newDecorator(ThrottlingStrategy<HttpRequest> strategy)
ThrottlingStrategy
instance.strategy
- The ThrottlingStrategy
instance to be usedprotected HttpResponse onFailure(ServiceRequestContext ctx, HttpRequest req, @Nullable Throwable cause) throws Exception
req
is throttled. By default, this method responds with the
HttpStatus.SERVICE_UNAVAILABLE
status.onFailure
in class ThrottlingService<HttpRequest,HttpResponse>
Exception
© Copyright 2015–2017 LINE Corporation. All rights reserved.