Class ThrottlingService
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Service<T_I,T_O>>
com.linecorp.armeria.server.DecoratingService<I,O,I,O>
com.linecorp.armeria.server.SimpleDecoratingService<I,O>
com.linecorp.armeria.server.throttling.AbstractThrottlingService<HttpRequest,HttpResponse>
com.linecorp.armeria.server.throttling.ThrottlingService
- All Implemented Interfaces:
Unwrappable,HttpService,Service<HttpRequest,HttpResponse>
public final class ThrottlingService
extends AbstractThrottlingService<HttpRequest,HttpResponse>
implements HttpService
Decorates an
HttpService to throttle incoming requests.-
Method Summary
Modifier and TypeMethodDescriptionstatic ThrottlingServiceBuilderbuilder(ThrottlingStrategy<HttpRequest> strategy) Returns a newThrottlingServiceBuilder.static Function<? super HttpService,ThrottlingService> newDecorator(ThrottlingStrategy<HttpRequest> strategy) Creates a new decorator using the specifiedThrottlingStrategy.static Function<? super HttpService,ThrottlingService> newDecorator(ThrottlingStrategy<HttpRequest> strategy, ThrottlingRejectHandler<HttpRequest, HttpResponse> rejectHandler) Creates a new decorator using the specifiedThrottlingStrategyandThrottlingRejectHandler.Methods inherited from class com.linecorp.armeria.server.throttling.AbstractThrottlingService
serveMethods inherited from class com.linecorp.armeria.server.DecoratingService
serviceAdded, shouldCachePathMethods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap, unwrapAllMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.linecorp.armeria.server.HttpService
decorate, decorate, exchangeType, serveMethods inherited from interface com.linecorp.armeria.server.Service
as, serviceAdded, shouldCachePath, unwrapMethods inherited from interface com.linecorp.armeria.common.util.Unwrappable
equalsIgnoreWrapper, unwrapAll
-
Method Details
-
newDecorator
public static Function<? super HttpService,ThrottlingService> newDecorator(ThrottlingStrategy<HttpRequest> strategy, ThrottlingRejectHandler<HttpRequest, HttpResponse> rejectHandler) Creates a new decorator using the specifiedThrottlingStrategyandThrottlingRejectHandler.- Parameters:
strategy- TheThrottlingStrategyinstance to define throttling strategyrejectHandler- TheThrottlingRejectHandlerinstance to define request rejection behaviour
-
newDecorator
public static Function<? super HttpService,ThrottlingService> newDecorator(ThrottlingStrategy<HttpRequest> strategy) Creates a new decorator using the specifiedThrottlingStrategy.- Parameters:
strategy- TheThrottlingStrategyinstance to define throttling strategy
-
builder
Returns a newThrottlingServiceBuilder.
-