@ -99,13 +99,13 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
@@ -99,13 +99,13 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
@Nullable
privatevolatileThreadsingletonCreationThread;
/** Flag that indicates whether we're currently within destroySingletons. */
@ -562,13 +562,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
@@ -562,13 +562,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
if(logger.isTraceEnabled()){
logger.trace("Destroying singletons in "+this);
}
this.singletonLock.lock();
try{
this.singletonsCurrentlyInDestruction=true;
}
finally{
this.singletonLock.unlock();
}
this.singletonsCurrentlyInDestruction=true;
String[]disposableBeanNames;
synchronized(this.disposableBeans){
@ -610,21 +604,28 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
@@ -610,21 +604,28 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
*@see#destroyBean
*/
publicvoiddestroySingleton(StringbeanName){
// Remove a registered singleton of the given name, if any.
this.singletonLock.lock();
try{
removeSingleton(beanName);
}
finally{
this.singletonLock.unlock();
}
// Destroy the corresponding DisposableBean instance.
// This also triggers the destruction of dependent beans.
@ -85,12 +85,11 @@ public class Service implements ApplicationContextAware, MessageSourceAware, Dis
@@ -85,12 +85,11 @@ public class Service implements ApplicationContextAware, MessageSourceAware, Dis