Further locking optimizations for the retrieval of non-singleton beans

Issue: SPR-12250
(cherry picked from commit ac4103d)
This commit is contained in:
Juergen Hoeller
2014-10-07 00:01:40 +02:00
parent b45d08f192
commit a1538a451a
2 changed files with 7 additions and 3 deletions

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -262,7 +262,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyConfig
public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
Object cacheKey = getCacheKey(bean.getClass(), beanName);
this.earlyProxyReferences.put(cacheKey, Boolean.TRUE);
if (!this.earlyProxyReferences.containsKey(cacheKey)) {
this.earlyProxyReferences.put(cacheKey, Boolean.TRUE);
}
return wrapIfNecessary(bean, beanName, cacheKey);
}

View File

@@ -1388,7 +1388,9 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
* @param beanName the name of the bean
*/
protected void markBeanAsCreated(String beanName) {
this.alreadyCreated.put(beanName, Boolean.TRUE);
if (!this.alreadyCreated.containsKey(beanName)) {
this.alreadyCreated.put(beanName, Boolean.TRUE);
}
}
/**