ConfigurableListableBeanFactory oldBeanFactory = null;
synchronized (this.beanFactoryMonitor) {
oldBeanFactory = this.beanFactory;
}
if (oldBeanFactory != null) {
oldBeanFactory.destroySingletons();
synchronized (this.beanFactoryMonitor) {
this.beanFactory = null;
}
}