Class ThrottlingRpcService
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<RpcRequest,RpcResponse>
com.linecorp.armeria.server.throttling.ThrottlingRpcService
- All Implemented Interfaces:
Unwrappable
,RpcService
,Service<RpcRequest,RpcResponse>
public final class ThrottlingRpcService extends AbstractThrottlingService<RpcRequest,RpcResponse> implements RpcService
Decorates an RPC
Service
to throttle incoming requests.-
Method Summary
Modifier and Type Method Description static ThrottlingRpcServiceBuilder
builder(ThrottlingStrategy<RpcRequest> strategy)
Returns a newThrottlingRpcServiceBuilder
.static Function<? super RpcService,ThrottlingRpcService>
newDecorator(ThrottlingStrategy<RpcRequest> strategy)
Creates a new decorator using the specifiedThrottlingStrategy
.static Function<? super RpcService,ThrottlingRpcService>
newDecorator(ThrottlingStrategy<RpcRequest> strategy, ThrottlingRejectHandler<RpcRequest,RpcResponse> 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, delegate, 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 RpcService,ThrottlingRpcService> newDecorator(ThrottlingStrategy<RpcRequest> strategy, ThrottlingRejectHandler<RpcRequest,RpcResponse> 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 RpcService,ThrottlingRpcService> newDecorator(ThrottlingStrategy<RpcRequest> strategy)Creates a new decorator using the specifiedThrottlingStrategy
.- Parameters:
strategy
- TheThrottlingStrategy
instance to define throttling strategy
-
builder
Returns a newThrottlingRpcServiceBuilder
.
-