DefaultSingletonBeanRegistry avoids singletonObjects lock wherever possible for non-singleton factory performance
Also fixing setCurrentlyInCreation to use a concurrent Set and to apply to prototype beans as well. Issue: SPR-9819
This commit is contained in:
@@ -56,7 +56,6 @@ class ConfigurationClassEnhancer {
|
||||
DisposableBeanMethodInterceptor.class, NoOp.class };
|
||||
|
||||
private static final CallbackFilter CALLBACK_FILTER = new CallbackFilter() {
|
||||
|
||||
public int accept(Method candidateMethod) {
|
||||
// Set up the callback filter to return the index of the BeanMethodInterceptor when
|
||||
// handling a @Bean-annotated method; otherwise, return index of the NoOp callback.
|
||||
@@ -72,7 +71,6 @@ class ConfigurationClassEnhancer {
|
||||
|
||||
private static final Callback DISPOSABLE_BEAN_METHOD_INTERCEPTOR = new DisposableBeanMethodInterceptor();
|
||||
|
||||
|
||||
private final Callback[] callbackInstances;
|
||||
|
||||
|
||||
@@ -162,6 +160,7 @@ class ConfigurationClassEnhancer {
|
||||
private static class GetObjectMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
private final ConfigurableBeanFactory beanFactory;
|
||||
|
||||
private final String beanName;
|
||||
|
||||
public GetObjectMethodInterceptor(ConfigurableBeanFactory beanFactory, String beanName) {
|
||||
@@ -296,7 +295,8 @@ class ConfigurationClassEnhancer {
|
||||
this.beanFactory.setCurrentlyInCreation(beanName, false);
|
||||
}
|
||||
return this.beanFactory.getBean(beanName);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
if (alreadyInCreation) {
|
||||
this.beanFactory.setCurrentlyInCreation(beanName, true);
|
||||
}
|
||||
@@ -347,6 +347,6 @@ class ConfigurationClassEnhancer {
|
||||
Enhancer.registerCallbacks(fbSubclass, callbackInstances);
|
||||
return fbSubclass.newInstance();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user