Interface Limit
- All Superinterfaces:
LimitAlgorithm, NamedService
- All Known Implementing Classes:
AimdLimit, FixedLimit, ThroughputLimit
Contract for a concurrency limiter.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRuntime context used when initializing aLimit.Nested classes/interfaces inherited from interface LimitAlgorithm
LimitAlgorithm.Outcome, LimitAlgorithm.Result<T>, LimitAlgorithm.TokenModifier and TypeInterfaceDescriptionstatic interfaceRepresents the outcome of a limit algorithm decision.static interfaceCarrier for both the result of aCallablesubjected to concurrency limits and the correspondingLimitAlgorithm.Outcome.static interfaceWhen a token is retrieved fromLimitAlgorithm.tryAcquireOutcome(), one of its methods must be called when the task is over, to release the token back to the pool (such as a permit returned to aSemaphore). -
Method Summary
Methods inherited from interface LimitAlgorithm
call, run, tryAcquireOutcome, tryAcquireOutcomeModifier and TypeMethodDescriptiondefault <T> LimitAlgorithm.Result<T> Invoke a callable within the limits of this limiter.default LimitAlgorithm.OutcomeInvoke a runnable within the limits of this limiter.default LimitAlgorithm.OutcomeTry to acquire a token, waiting for available permits for the configured amount of time, if queuing is enabled.tryAcquireOutcome(boolean wait) Tries to acquire a token, waiting for available permits for the configured amount of time ifwaitis enabled and the implementation supports queueing, returning immediately otherwise.Methods inherited from interface NamedService
name, typeModifier and TypeMethodDescriptionname()Name of this implementation, as provided inConfiguredProvider.create(Config, String).type()Type of this implementation, to distinguish instances of same type, with differentNamedService.name().
-
Method Details
-
copy
-
init
Initialization method for this limit. This method can be used for any task, including metrics initialization.- Parameters:
context- the context for limit initialization
-
init
Deprecated.useinit(InitializationContext)to provide initialization details explicitly.Initialization method for this limit. This method can be used for any task, including metrics initialization.- Parameters:
originName- origin name for this limit, such as"@default"
-
init(InitializationContext)to provide initialization details explicitly.