Use concurrent hash map in function catalog
This commit is contained in:
@@ -32,6 +32,7 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -172,11 +173,11 @@ public class ContextFunctionCatalogAutoConfiguration {
|
|||||||
@Component
|
@Component
|
||||||
protected static class ContextFunctionRegistry {
|
protected static class ContextFunctionRegistry {
|
||||||
|
|
||||||
private Map<String, Object> suppliers = new HashMap<>();
|
private Map<String, Object> suppliers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private Map<String, Object> functions = new HashMap<>();
|
private Map<String, Object> functions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private Map<String, Object> consumers = new HashMap<>();
|
private Map<String, Object> consumers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private ApplicationEventPublisher publisher;
|
private ApplicationEventPublisher publisher;
|
||||||
@@ -184,16 +185,16 @@ public class ContextFunctionCatalogAutoConfiguration {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ConfigurableListableBeanFactory registry;
|
private ConfigurableListableBeanFactory registry;
|
||||||
|
|
||||||
private Map<Object, String> names = new HashMap<>();
|
private Map<Object, String> names = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private Map<String, FunctionType> types = new HashMap<>();
|
private Map<String, FunctionType> types = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public Set<String> getSuppliers() {
|
public Set<String> getSuppliers() {
|
||||||
return this.suppliers.keySet();
|
return this.suppliers.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FunctionRegistration<?> getRegistration(Object function) {
|
public FunctionRegistration<?> getRegistration(Object function) {
|
||||||
if (!names.containsKey(function)) {
|
if (function == null || !names.containsKey(function)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new FunctionRegistration<>(function).name(names.get(function))
|
return new FunctionRegistration<>(function).name(names.get(function))
|
||||||
|
|||||||
Reference in New Issue
Block a user