Attempt to fix ConcurrentModificationException
Attempt to fix `ConcurrentModificationException` which occurs on Java 11+. See gh-23326
This commit is contained in:
@@ -88,7 +88,12 @@ public class DefaultBootstrapContext implements ConfigurableBootstrapContext {
|
||||
synchronized (this.instanceSuppliers) {
|
||||
InstanceSupplier<?> instanceSupplier = this.instanceSuppliers.get(type);
|
||||
Assert.state(instanceSupplier != null, () -> type.getName() + " has not been registered");
|
||||
return (T) this.instances.computeIfAbsent(type, (key) -> instanceSupplier.get(this));
|
||||
T instance = (T) this.instances.get(type);
|
||||
if (instance == null) {
|
||||
instance = (T) instanceSupplier.get(this);
|
||||
this.instances.put(type, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user