consistent use of JDK 1.5's ThreadLocal.remove() over ThreadLocal.set(null), preventing leaks (SPR-7441)
This commit is contained in:
@@ -904,13 +904,13 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
protected void afterPrototypeCreation(String beanName) {
|
||||
Object curVal = this.prototypesCurrentlyInCreation.get();
|
||||
if (curVal instanceof String) {
|
||||
this.prototypesCurrentlyInCreation.set(null);
|
||||
this.prototypesCurrentlyInCreation.remove();
|
||||
}
|
||||
else if (curVal instanceof Set) {
|
||||
Set<String> beanNameSet = (Set<String>) curVal;
|
||||
beanNameSet.remove(beanName);
|
||||
if (beanNameSet.isEmpty()) {
|
||||
this.prototypesCurrentlyInCreation.set(null);
|
||||
this.prototypesCurrentlyInCreation.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
|
||||
finally {
|
||||
currentResources.remove(encodedResource);
|
||||
if (currentResources.isEmpty()) {
|
||||
this.resourcesCurrentlyBeingLoaded.set(null);
|
||||
this.resourcesCurrentlyBeingLoaded.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user