Class InMemoryRateLimiterRegistry
java.lang.Object
io.github.resilience4j.core.registry.AbstractRegistry<RateLimiter,RateLimiterConfig>
io.github.resilience4j.ratelimiter.internal.InMemoryRateLimiterRegistry
- All Implemented Interfaces:
io.github.resilience4j.core.Registry<RateLimiter,,RateLimiterConfig> RateLimiterRegistry
public class InMemoryRateLimiterRegistry
extends io.github.resilience4j.core.registry.AbstractRegistry<RateLimiter,RateLimiterConfig>
implements RateLimiterRegistry
Backend RateLimiter manager. Constructs backend RateLimiters according to configuration values.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.resilience4j.ratelimiter.RateLimiterRegistry
RateLimiterRegistry.BuilderNested classes/interfaces inherited from interface io.github.resilience4j.core.Registry
io.github.resilience4j.core.Registry.EventPublisher<E extends Object> -
Field Summary
Fields inherited from class io.github.resilience4j.core.registry.AbstractRegistry
CONFIG_MUST_NOT_BE_NULL, configurations, CONSUMER_MUST_NOT_BE_NULL, DEFAULT_CONFIG, entryMap, registryTags, SUPPLIER_MUST_NOT_BE_NULL, TAGS_MUST_NOT_BE_NULL -
Constructor Summary
ConstructorsConstructorDescriptionThe constructor with default default.InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig) The constructor with custom default config.InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer) InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer, Map<String, String> tags) InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers) InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers, Map<String, String> tags) InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, Map<String, String> tags) InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer) InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer, Map<String, String> tags) InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers) InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers, Map<String, String> tags) InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers, Map<String, String> tags, io.github.resilience4j.core.RegistryStore<RateLimiter> registryStore) InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, Map<String, String> tags) -
Method Summary
Modifier and TypeMethodDescriptionReturns all managedRateLimiterinstances.rateLimiter(String name) Returns a managedRateLimiteror creates a new one with the default RateLimiter configuration.rateLimiter(String name, RateLimiterConfig config) Returns a managedRateLimiteror creates a new one with a custom RateLimiter configuration.rateLimiter(String name, RateLimiterConfig config, Map<String, String> tags) Returns a managedRateLimiteror creates a new one with a custom RateLimiter configuration.rateLimiter(String name, String configName) Returns a managedRateLimiteror creates a new one.Returns a managedRateLimiteror creates a new one.rateLimiter(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier) Returns a managedRateLimiterConfigor creates a new one with a custom RateLimiterConfig configuration.rateLimiter(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier, Map<String, String> tags) Returns a managedRateLimiterConfigor creates a new one with a custom RateLimiterConfig configuration.rateLimiter(String name, Map<String, String> tags) Returns a managedRateLimiteror creates a new one with the default RateLimiter configuration.Methods inherited from class io.github.resilience4j.core.registry.AbstractRegistry
addConfiguration, computeIfAbsent, find, getAllTags, getConfiguration, getDefaultConfig, getEventPublisher, getTags, remove, removeConfiguration, replaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.resilience4j.core.Registry
addConfiguration, find, getConfiguration, getDefaultConfig, getEventPublisher, getTags, remove, removeConfiguration, replace
-
Constructor Details
-
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry()The constructor with default default. -
InMemoryRateLimiterRegistry
-
InMemoryRateLimiterRegistry
-
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer, Map<String, String> tags) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers, Map<String, String> tags) -
InMemoryRateLimiterRegistry
The constructor with custom default config.- Parameters:
defaultConfig- The default config.
-
InMemoryRateLimiterRegistry
-
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer, Map<String, String> tags) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(RateLimiterConfig defaultConfig, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers, Map<String, String> tags) -
InMemoryRateLimiterRegistry
public InMemoryRateLimiterRegistry(Map<String, RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers, Map<String, String> tags, io.github.resilience4j.core.RegistryStore<RateLimiter> registryStore)
-
-
Method Details
-
getAllRateLimiters
Returns all managedRateLimiterinstances.- Specified by:
getAllRateLimitersin interfaceRateLimiterRegistry- Returns:
- all managed
RateLimiterinstances.
-
rateLimiter
Returns a managedRateLimiteror creates a new one with the default RateLimiter configuration.- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiter- Returns:
- The
RateLimiter
-
rateLimiter
Returns a managedRateLimiteror creates a new one with the default RateLimiter configuration.The
tagspassed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimitertags- tags added to the RateLimiter- Returns:
- The
RateLimiter
-
rateLimiter
Returns a managedRateLimiteror creates a new one with a custom RateLimiter configuration.- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiterconfig- a custom RateLimiter configuration- Returns:
- The
RateLimiter
-
rateLimiter
Returns a managedRateLimiteror creates a new one with a custom RateLimiter configuration.The
tagspassed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiterconfig- a custom RateLimiter configurationtags- tags added to the RateLimiter- Returns:
- The
RateLimiter
-
rateLimiter
Returns a managedRateLimiterConfigor creates a new one with a custom RateLimiterConfig configuration.- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiterConfigrateLimiterConfigSupplier- a supplier of a custom RateLimiterConfig configuration- Returns:
- The
RateLimiterConfig
-
rateLimiter
public RateLimiter rateLimiter(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier, Map<String, String> tags) Returns a managedRateLimiterConfigor creates a new one with a custom RateLimiterConfig configuration.The
tagspassed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiterConfigrateLimiterConfigSupplier- a supplier of a custom RateLimiterConfig configurationtags- tags added to the RateLimiter- Returns:
- The
RateLimiterConfig
-
rateLimiter
Returns a managedRateLimiteror creates a new one. The configuration must have been added upfront viaRegistry.addConfiguration(String, Object).- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiterconfigName- the name of the shared configuration- Returns:
- The
RateLimiter
-
rateLimiter
Returns a managedRateLimiteror creates a new one. The configuration must have been added upfront viaRegistry.addConfiguration(String, Object).- Specified by:
rateLimiterin interfaceRateLimiterRegistry- Parameters:
name- the name of the RateLimiterconfigName- the name of the shared configuration- Returns:
- The
RateLimiter
-