Top Description Inners Fields Constructors Methods
io.github.resilience4j.core.registry

public Class AbstractRegistry<E, C>

extends Object
implements Registry<E, C>
Class Inheritance
All Implemented Interfaces
io.github.resilience4j.core.Registry
Imports
io.github.resilience4j.core.EventConsumer, .EventProcessor, .Registry, .RegistryStore, java.util.*, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, java.util.function.Supplier

Abstract registry to be shared with all resilience4j registries

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
protected static final String
protected final ConcurrentMap<String, C>
protected static final String
protected static final String
protected final RegistryStore<E>
private final AbstractRegistry<E, C>.RegistryEventProcessor
private static final String
private static final String
protected final Map<String, String>
registryTags

Global tags which must be added to each instance created by this registry.

protected static final String
protected static final String

Constructor Summary

AccessConstructor and Description
public
AbstractRegistry(C defaultConfig)

public
AbstractRegistry(C defaultConfig, Map<String, String> registryTags)

public
AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer)

public
AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer, Map<String, String> tags)

public
AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers)

public
AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers, Map<String, String> tags)

public
AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers, Map<String, String> tags, RegistryStore<E> registryStore)

Method Summary

Modifier and TypeMethod and Description
public void
addConfiguration(String
the configuration name
configName
,
C
the added configuration
configuration
)

Implements io.github.resilience4j.core.Registry.addConfiguration.

Adds a configuration to the registry

protected E
computeIfAbsent(String name, Supplier<E> supplier)

public Optional<E>
find(String
the name
name
)

Implements io.github.resilience4j.core.Registry.find.

Find a named entry in the Registry

protected Map<String, String>

Returns:

Map containing all tags
getAllTags
(Map<String, String>
Tags of the instance.
tags
)

Creates map with all tags (registry and instance).

public Optional<C>
getConfiguration(String
the configuration name
configName
)

Implements io.github.resilience4j.core.Registry.getConfiguration.

Get a configuration by name

public C
public Registry.EventPublisher<E>
getEventPublisher()

Implements io.github.resilience4j.core.Registry.getEventPublisher.

Returns an EventPublisher which can be used to register event consumers.

public Map<String, String>
public Optional<E>
remove(String
the name
name
)

Implements io.github.resilience4j.core.Registry.remove.

Remove an entry from the Registry

public C
removeConfiguration(String configName)

Implements io.github.resilience4j.core.Registry.removeConfiguration.

+ * Removes a configuration from the registry + * + * @param configName the configuration name + * @return configuration mapped to the configName.

public Optional<E>
replace(String
the existing name
name
,
E
a new entry
newEntry
)

Implements io.github.resilience4j.core.Registry.replace.

Replace an existing entry in the Registry by a new one.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONFIG_MUST_NOT_BE_NULLback to summary
protected static final String CONFIG_MUST_NOT_BE_NULL
configurationsback to summary
protected final ConcurrentMap<String, C> configurations
CONSUMER_MUST_NOT_BE_NULLback to summary
protected static final String CONSUMER_MUST_NOT_BE_NULL
DEFAULT_CONFIGback to summary
protected static final String DEFAULT_CONFIG
entryMapback to summary
protected final RegistryStore<E> entryMap
eventProcessorback to summary
private final AbstractRegistry<E, C>.RegistryEventProcessor eventProcessor
NAME_MUST_NOT_BE_NULLback to summary
private static final String NAME_MUST_NOT_BE_NULL
REGISTRY_STORE_MUST_NOT_BE_NULLback to summary
private static final String REGISTRY_STORE_MUST_NOT_BE_NULL
registryTagsback to summary
protected final Map<String, String> registryTags

Global tags which must be added to each instance created by this registry.

SUPPLIER_MUST_NOT_BE_NULLback to summary
protected static final String SUPPLIER_MUST_NOT_BE_NULL
TAGS_MUST_NOT_BE_NULLback to summary
protected static final String TAGS_MUST_NOT_BE_NULL

Constructor Detail

AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig)
AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig, Map<String, String> registryTags)
AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer)
AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer, Map<String, String> tags)
AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers)
AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers, Map<String, String> tags)
AbstractRegistryback to summary
public AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers, Map<String, String> tags, RegistryStore<E> registryStore)

Method Detail

addConfigurationback to summary
public void addConfiguration(String configName, C configuration)

Implements io.github.resilience4j.core.Registry.addConfiguration.

Doc from io.github.resilience4j.core.Registry.addConfiguration.

Adds a configuration to the registry

Parameters
configName:String

the configuration name

configuration:C

the added configuration

Annotations
@Override
computeIfAbsentback to summary
protected E computeIfAbsent(String name, Supplier<E> supplier)
findback to summary
public Optional<E> find(String name)

Implements io.github.resilience4j.core.Registry.find.

Doc from io.github.resilience4j.core.Registry.find.

Find a named entry in the Registry

Parameters
name:String

the name

Annotations
@Override
getAllTagsback to summary
protected Map<String, String> getAllTags(Map<String, 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:Map<String, String>

Tags of the instance.

Returns:Map<String, String>

Map containing all tags

getConfigurationback to summary
public Optional<C> getConfiguration(String configName)

Implements io.github.resilience4j.core.Registry.getConfiguration.

Doc from io.github.resilience4j.core.Registry.getConfiguration.

Get a configuration by name

Parameters
configName:String

the configuration name

Returns:Optional<C>

the found configuration if any

Annotations
@Override
getDefaultConfigback to summary
public C getDefaultConfig()

Implements io.github.resilience4j.core.Registry.getDefaultConfig.

Doc from io.github.resilience4j.core.Registry.getDefaultConfig.

Get the default configuration

Returns:C

the default configuration

Annotations
@Override
getEventPublisherback to summary
public Registry.EventPublisher<E> getEventPublisher()

Implements io.github.resilience4j.core.Registry.getEventPublisher.

Doc from io.github.resilience4j.core.Registry.getEventPublisher.

Returns an EventPublisher which can be used to register event consumers.

Returns:Registry.EventPublisher<E>

an EventPublisher

Annotations
@Override
getTagsback to summary
public Map<String, String> getTags()

Implements io.github.resilience4j.core.Registry.getTags.

Returns:Map<String, String>

Doc from io.github.resilience4j.core.Registry.getTags.

global configured registry tags

Annotations
@Override
removeback to summary
public Optional<E> remove(String name)

Implements io.github.resilience4j.core.Registry.remove.

Doc from io.github.resilience4j.core.Registry.remove.

Remove an entry from the Registry

Parameters
name:String

the name

Annotations
@Override
removeConfigurationback to summary
public C removeConfiguration(String configName)

Implements io.github.resilience4j.core.Registry.removeConfiguration.

Doc from io.github.resilience4j.core.Registry.removeConfiguration.

+ * Removes a configuration from the registry + * + * @param configName the configuration name + * @return configuration mapped to the configName. +

Annotations
@Override
replaceback to summary
public Optional<E> replace(String name, E newEntry)

Implements io.github.resilience4j.core.Registry.replace.

Doc from io.github.resilience4j.core.Registry.replace.

Replace an existing entry in the Registry by a new one.

Parameters
name:String

the existing name

newEntry:E

a new entry

Annotations
@Override
io.github.resilience4j.core.registry back to summary

private Class AbstractRegistry.RegistryEventProcessor

extends EventProcessor<RegistryEvent>
implements EventConsumer<RegistryEvent>, Registry.EventPublisher<E>
Class Inheritance
All Implemented Interfaces
io.github.resilience4j.core.Registry.EventPublisher, io.github.resilience4j.core.EventPublisher, io.github.resilience4j.core.EventConsumer

Constructor Summary

AccessConstructor and Description
private
private

Method Summary

Modifier and TypeMethod and Description
public void
public Registry.EventPublisher<E>
public Registry.EventPublisher<E>
public Registry.EventPublisher<E>
Inherited from io.github.resilience4j.core.EventProcessor:
hasConsumersonEventprocessEventregisterConsumer

Constructor Detail

RegistryEventProcessorback to summary
private RegistryEventProcessor()
RegistryEventProcessorback to summary
private RegistryEventProcessor(List<RegistryEventConsumer<E>> registryEventConsumers)

Method Detail

consumeEventback to summary
public void consumeEvent(RegistryEvent event)

Implements io.github.resilience4j.core.EventConsumer.consumeEvent.

Annotations
@Override
onEntryAddedback to summary
public Registry.EventPublisher<E> onEntryAdded(EventConsumer<EntryAddedEvent<E>> onSuccessEventConsumer)

Implements io.github.resilience4j.core.Registry.EventPublisher.onEntryAdded.

Annotations
@Override
onEntryRemovedback to summary
public Registry.EventPublisher<E> onEntryRemoved(EventConsumer<EntryRemovedEvent<E>> onErrorEventConsumer)

Implements io.github.resilience4j.core.Registry.EventPublisher.onEntryRemoved.

Annotations
@Override
onEntryReplacedback to summary
public Registry.EventPublisher<E> onEntryReplaced(EventConsumer<EntryReplacedEvent<E>> onStateTransitionEventConsumer)

Implements io.github.resilience4j.core.Registry.EventPublisher.onEntryReplaced.

Annotations
@Override