Protect refresh of single bean as well

This commit is contained in:
Dave Syer
2017-10-04 14:34:06 +01:00
parent c28ca5de91
commit a7caee5f1f

View File

@@ -157,7 +157,14 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
protected boolean destroy(String name) {
BeanLifecycleWrapper wrapper = this.cache.remove(name);
if (wrapper != null) {
wrapper.destroy();
Lock lock = locks.get(wrapper.getName()).writeLock();
lock.lock();
try {
wrapper.destroy();
}
finally {
lock.unlock();
}
this.errors.remove(name);
return true;
}