Class AbstractRegistry<E,C>
java.lang.Object
io.github.resilience4j.core.registry.AbstractRegistry<E,C>
- All Implemented Interfaces:
Registry<E,C>
public class AbstractRegistry<E,C> extends java.lang.Object implements Registry<E,C>
Abstract registry to be shared with all resilience4j registries
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.resilience4j.core.Registry
Registry.EventPublisher<E> -
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCONFIG_MUST_NOT_BE_NULLprotected java.util.concurrent.ConcurrentMap<java.lang.String,C>configurationsprotected static java.lang.StringCONSUMER_MUST_NOT_BE_NULLprotected static java.lang.StringDEFAULT_CONFIGprotected RegistryStore<E>entryMapprotected io.vavr.collection.Map<java.lang.String,java.lang.String>registryTagsGlobal tags which must be added to each instance created by this registry.protected static java.lang.StringSUPPLIER_MUST_NOT_BE_NULLprotected static java.lang.StringTAGS_MUST_NOT_BE_NULL -
Constructor Summary
Constructors Constructor Description AbstractRegistry(C defaultConfig)AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer)AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer, io.vavr.collection.Map<java.lang.String,java.lang.String> tags)AbstractRegistry(C defaultConfig, io.vavr.collection.Map<java.lang.String,java.lang.String> registryTags)AbstractRegistry(C defaultConfig, java.util.List<RegistryEventConsumer<E>> registryEventConsumers)AbstractRegistry(C defaultConfig, java.util.List<RegistryEventConsumer<E>> registryEventConsumers, io.vavr.collection.Map<java.lang.String,java.lang.String> tags)AbstractRegistry(C defaultConfig, java.util.List<RegistryEventConsumer<E>> registryEventConsumers, io.vavr.collection.Map<java.lang.String,java.lang.String> tags, RegistryStore<E> registryStore) -
Method Summary
Modifier and Type Method Description voidaddConfiguration(java.lang.String configName, C configuration)Adds a configuration to the registryprotected EcomputeIfAbsent(java.lang.String name, java.util.function.Supplier<E> supplier)java.util.Optional<E>find(java.lang.String name)Find a named entry in the Registryprotected io.vavr.collection.Map<java.lang.String,java.lang.String>getAllTags(io.vavr.collection.Map<java.lang.String,java.lang.String> tags)Creates map with all tags (registry and instance).java.util.Optional<C>getConfiguration(java.lang.String configName)Get a configuration by nameCgetDefaultConfig()Get the default configurationRegistry.EventPublisher<E>getEventPublisher()Returns an EventPublisher which can be used to register event consumers.io.vavr.collection.Map<java.lang.String,java.lang.String>getTags()java.util.Optional<E>remove(java.lang.String name)Remove an entry from the Registryjava.util.Optional<E>replace(java.lang.String name, E newEntry)Replace an existing entry in the Registry by a new one.
-
Field Details
-
DEFAULT_CONFIG
protected static final java.lang.String DEFAULT_CONFIG- See Also:
- Constant Field Values
-
CONFIG_MUST_NOT_BE_NULL
protected static final java.lang.String CONFIG_MUST_NOT_BE_NULL- See Also:
- Constant Field Values
-
CONSUMER_MUST_NOT_BE_NULL
protected static final java.lang.String CONSUMER_MUST_NOT_BE_NULL- See Also:
- Constant Field Values
-
SUPPLIER_MUST_NOT_BE_NULL
protected static final java.lang.String SUPPLIER_MUST_NOT_BE_NULL- See Also:
- Constant Field Values
-
TAGS_MUST_NOT_BE_NULL
protected static final java.lang.String TAGS_MUST_NOT_BE_NULL- See Also:
- Constant Field Values
-
entryMap
-
configurations
-
registryTags
protected final io.vavr.collection.Map<java.lang.String,java.lang.String> registryTagsGlobal tags which must be added to each instance created by this registry.
-
-
Constructor Details
-
AbstractRegistry
-
AbstractRegistry
public AbstractRegistry(C defaultConfig, io.vavr.collection.Map<java.lang.String,java.lang.String> registryTags) -
AbstractRegistry
-
AbstractRegistry
public AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer, io.vavr.collection.Map<java.lang.String,java.lang.String> tags) -
AbstractRegistry
public AbstractRegistry(C defaultConfig, java.util.List<RegistryEventConsumer<E>> registryEventConsumers) -
AbstractRegistry
public AbstractRegistry(C defaultConfig, java.util.List<RegistryEventConsumer<E>> registryEventConsumers, io.vavr.collection.Map<java.lang.String,java.lang.String> tags) -
AbstractRegistry
public AbstractRegistry(C defaultConfig, java.util.List<RegistryEventConsumer<E>> registryEventConsumers, io.vavr.collection.Map<java.lang.String,java.lang.String> tags, RegistryStore<E> registryStore)
-
-
Method Details
-
computeIfAbsent
-
find
Description copied from interface:RegistryFind a named entry in the Registry -
remove
Description copied from interface:RegistryRemove an entry from the Registry -
replace
Description copied from interface:RegistryReplace an existing entry in the Registry by a new one. -
addConfiguration
Description copied from interface:RegistryAdds a configuration to the registry- Specified by:
addConfigurationin interfaceRegistry<E,C>- Parameters:
configName- the configuration nameconfiguration- the added configuration
-
getConfiguration
Description copied from interface:RegistryGet a configuration by name- Specified by:
getConfigurationin interfaceRegistry<E,C>- Parameters:
configName- the configuration name- Returns:
- the found configuration if any
-
getDefaultConfig
Description copied from interface:RegistryGet the default configuration- Specified by:
getDefaultConfigin interfaceRegistry<E,C>- Returns:
- the default configuration
-
getTags
public io.vavr.collection.Map<java.lang.String,java.lang.String> getTags() -
getEventPublisher
Description copied from interface:RegistryReturns an EventPublisher which can be used to register event consumers.- Specified by:
getEventPublisherin interfaceRegistry<E,C>- Returns:
- an EventPublisher
-
getAllTags
protected io.vavr.collection.Map<java.lang.String,java.lang.String> getAllTags(io.vavr.collection.Map<java.lang.String,java.lang.String> tags)Creates map with all tags (registry and instance). When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.- Parameters:
tags- Tags of the instance.- Returns:
- Map containing all tags
-