consistent use of JDK 1.5's ThreadLocal.remove() over ThreadLocal.set(null), preventing leaks (SPR-7441)

This commit is contained in:
Juergen Hoeller
2010-09-01 17:17:25 +00:00
parent 66a5bb7c22
commit e56cfb8173
14 changed files with 47 additions and 42 deletions

View File

@@ -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();
}
}
}

View File

@@ -344,7 +344,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
finally {
currentResources.remove(encodedResource);
if (currentResources.isEmpty()) {
this.resourcesCurrentlyBeingLoaded.set(null);
this.resourcesCurrentlyBeingLoaded.remove();
}
}
}