Further locking optimizations for the retrieval of non-singleton beans
Issue: SPR-12250
(cherry picked from commit 9d83281)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -274,7 +274,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig
|
|||||||
@Override
|
@Override
|
||||||
public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
|
public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
|
||||||
Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
||||||
this.earlyProxyReferences.add(cacheKey);
|
if (!this.earlyProxyReferences.contains(cacheKey)) {
|
||||||
|
this.earlyProxyReferences.add(cacheKey);
|
||||||
|
}
|
||||||
return wrapIfNecessary(bean, beanName, cacheKey);
|
return wrapIfNecessary(bean, beanName, cacheKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -959,7 +959,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActuallyInCreation(String beanName) {
|
public boolean isActuallyInCreation(String beanName) {
|
||||||
return isSingletonCurrentlyInCreation(beanName) || isPrototypeCurrentlyInCreation(beanName);
|
return (isSingletonCurrentlyInCreation(beanName) || isPrototypeCurrentlyInCreation(beanName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1435,7 +1435,9 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||||||
* @param beanName the name of the bean
|
* @param beanName the name of the bean
|
||||||
*/
|
*/
|
||||||
protected void markBeanAsCreated(String beanName) {
|
protected void markBeanAsCreated(String beanName) {
|
||||||
this.alreadyCreated.add(beanName);
|
if (!this.alreadyCreated.contains(beanName)) {
|
||||||
|
this.alreadyCreated.add(beanName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user