Browse Source

Further locking optimizations for the retrieval of non-singleton beans

Issue: SPR-12250
pull/656/head
Juergen Hoeller 11 years ago
parent
commit
9d832816a8
  1. 4
      spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java
  2. 6
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

4
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

@ -226,7 +226,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport @@ -226,7 +226,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
@Override
public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
Object cacheKey = getCacheKey(bean.getClass(), beanName);
this.earlyProxyReferences.add(cacheKey);
if (!this.earlyProxyReferences.contains(cacheKey)) {
this.earlyProxyReferences.add(cacheKey);
}
return wrapIfNecessary(bean, beanName, cacheKey);
}

6
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java

@ -959,7 +959,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp @@ -959,7 +959,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
@Override
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 @@ -1435,7 +1435,9 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
* @param beanName the name of the bean
*/
protected void markBeanAsCreated(String beanName) {
this.alreadyCreated.add(beanName);
if (!this.alreadyCreated.contains(beanName)) {
this.alreadyCreated.add(beanName);
}
}
/**

Loading…
Cancel
Save