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 Type Method Description static ThrottlingServiceBuilder
builder(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 specifiedThrottlingStrategy
andThrottlingRejectHandler
.Methods inherited from class com.linecorp.armeria.server.DecoratingService
serviceAdded, shouldCachePath
Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.server.Service
as, serviceAdded, shouldCachePath, unwrap
-
Method Details
-
newDecorator
public static Function<? super HttpService,ThrottlingService> newDecorator(ThrottlingStrategy<HttpRequest> strategy, ThrottlingRejectHandler<HttpRequest,HttpResponse> rejectHandler)Creates a new decorator using the specifiedThrottlingStrategy
andThrottlingRejectHandler
.- Parameters:
strategy
- TheThrottlingStrategy
instance to define throttling strategyrejectHandler
- TheThrottlingRejectHandler
instance 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
- TheThrottlingStrategy
instance to define throttling strategy
-
builder
Returns a newThrottlingServiceBuilder
.
-