chore: various improvements as suggested by sonar (#797)
* various improvements as suggested by sonar Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com> * revert clonable change Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com> --------- Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
This commit is contained in:
parent
69f95b1bfd
commit
6c8657d520
|
|
@ -163,8 +163,8 @@ class EventSupport {
|
|||
|
||||
private final Map<ProviderEvent, List<Consumer<EventDetails>>> handlerMap;
|
||||
|
||||
{
|
||||
handlerMap = new ConcurrentHashMap<ProviderEvent, List<Consumer<EventDetails>>>();
|
||||
HandlerStore() {
|
||||
handlerMap = new ConcurrentHashMap<>();
|
||||
handlerMap.put(ProviderEvent.PROVIDER_READY, new ArrayList<>());
|
||||
handlerMap.put(ProviderEvent.PROVIDER_CONFIGURATION_CHANGED, new ArrayList<>());
|
||||
handlerMap.put(ProviderEvent.PROVIDER_ERROR, new ArrayList<>());
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public final class ImmutableStructure extends AbstractStructure {
|
|||
.collect(HashMap::new,
|
||||
(accumulated, entry) -> accumulated.put(entry.getKey(),
|
||||
Optional.ofNullable(entry.getValue())
|
||||
.map(e -> e.clone())
|
||||
.map(Value::clone)
|
||||
.orElse(null)),
|
||||
HashMap::putAll)));
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ public final class ImmutableStructure extends AbstractStructure {
|
|||
.collect(HashMap::new,
|
||||
(accumulated, entry) -> accumulated.put(entry.getKey(),
|
||||
Optional.ofNullable(entry.getValue())
|
||||
.map(e -> e.clone())
|
||||
.map(Value::clone)
|
||||
.orElse(null)),
|
||||
HashMap::putAll);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public class MutableContext implements EvaluationContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
public MutableStructure add(String ignoredKey, MutableStructure ignoredValue) {
|
||||
public MutableStructure add(String ignoredKey, Structure ignoredValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class MutableStructure extends AbstractStructure {
|
|||
return this;
|
||||
}
|
||||
|
||||
public <T> MutableStructure add(String key, List<Value> value) {
|
||||
public MutableStructure add(String key, List<Value> value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@ public class NoOpProvider implements FeatureProvider {
|
|||
|
||||
@Override
|
||||
public Metadata getMetadata() {
|
||||
return new Metadata() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
};
|
||||
return () -> name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ class ProviderRepository {
|
|||
private void shutdownProvider(FeatureProvider provider) {
|
||||
taskExecutor.submit(() -> {
|
||||
try {
|
||||
// detachProviderEvents(provider);
|
||||
provider.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("Exception when shutting down feature provider {}", provider.getClass().getName(), e);
|
||||
|
|
|
|||
|
|
@ -266,7 +266,6 @@ public class Value implements Cloneable {
|
|||
*
|
||||
* @return Value
|
||||
*/
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
protected Value clone() {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class InMemoryProvider extends EventProvider {
|
|||
* @param evaluationContext evaluation context
|
||||
* @throws Exception on error
|
||||
*/
|
||||
@Override
|
||||
public void initialize(EvaluationContext evaluationContext) throws Exception {
|
||||
super.initialize(evaluationContext);
|
||||
state = ProviderState.READY;
|
||||
|
|
|
|||
Loading…
Reference in New Issue