Avoiding NPE for proxied beans upon context shutdown; fixes gh-340
This commit is contained in:
@@ -466,7 +466,14 @@ public class GenericScope implements Scope, BeanFactoryPostProcessor,
|
||||
return invocation.proceed();
|
||||
}
|
||||
Object proxy = getObject();
|
||||
Lock lock = locks.get(this.targetBeanName).readLock();
|
||||
ReadWriteLock readWriteLock = locks.get(this.targetBeanName);
|
||||
if (readWriteLock == null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("For bean with name [" + this.targetBeanName + "] there is no read write lock. Will create a new one to avoid NPE");
|
||||
}
|
||||
readWriteLock = new ReentrantReadWriteLock();
|
||||
}
|
||||
Lock lock = readWriteLock.readLock();
|
||||
lock.lock();
|
||||
try {
|
||||
if (proxy instanceof Advised) {
|
||||
|
||||
Reference in New Issue
Block a user