BuilderT
- Concrete builder type specific to an RPC mechanismContextT
- Type capturing the context of a request for the concrete RPC mechanismpublic abstract class AbstractLimiterBuilder<BuilderT extends AbstractLimiterBuilder<BuilderT,ContextT>,ContextT>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected LookupPartitionStrategy.Builder<ContextT> |
builder |
protected Limit |
limit |
protected Strategy<ContextT> |
strategy |
Constructor and Description |
---|
AbstractLimiterBuilder() |
Modifier and Type | Method and Description |
---|---|
protected Strategy<ContextT> |
getFinalStrategy() |
BuilderT |
limit(Limit limit)
Set the limit algorithm to use.
|
BuilderT |
partitionByLookup(java.util.function.Function<ContextT,java.lang.String> contextToGroup,
java.util.function.Consumer<LookupPartitionStrategy.Builder<ContextT>> configurer)
Configure the strategy for partitioning the limit.
|
protected abstract BuilderT |
self() |
BuilderT |
strategy(Strategy<ContextT> strategy)
Strategy for acquiring a token from the limiter based on the context.
|
protected LookupPartitionStrategy.Builder<ContextT> builder
protected Limit limit
public BuilderT partitionByLookup(java.util.function.Function<ContextT,java.lang.String> contextToGroup, java.util.function.Consumer<LookupPartitionStrategy.Builder<ContextT>> configurer)
contextToGroup
- Mapper from the context to a name group associated with a percentage of the limitconfigurer
- Function through which the value set support by the func may be assigned
a percentage of the limitpublic BuilderT strategy(Strategy<ContextT> strategy)
strategy
- public BuilderT limit(Limit limit)
VegasLimit
limit
- Limit algorithm to useprotected abstract BuilderT self()