Merge branch '6.2.x'
This commit is contained in:
@@ -301,26 +301,29 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
beforeSingletonCreation(beanName);
|
||||
}
|
||||
catch (BeanCurrentlyInCreationException ex) {
|
||||
if (locked) {
|
||||
this.lenientCreationLock.lock();
|
||||
try {
|
||||
while ((singletonObject = this.singletonObjects.get(beanName)) == null) {
|
||||
if (!this.singletonsInLenientCreation.contains(beanName)) {
|
||||
throw ex;
|
||||
}
|
||||
try {
|
||||
this.lenientCreationFinished.await();
|
||||
}
|
||||
catch (InterruptedException ie) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
this.lenientCreationLock.lock();
|
||||
try {
|
||||
while ((singletonObject = this.singletonObjects.get(beanName)) == null) {
|
||||
if (!this.singletonsInLenientCreation.contains(beanName)) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
this.lenientCreationFinished.await();
|
||||
}
|
||||
catch (InterruptedException ie) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
return singletonObject;
|
||||
}
|
||||
finally {
|
||||
this.lenientCreationLock.unlock();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.lenientCreationLock.unlock();
|
||||
}
|
||||
if (singletonObject != null) {
|
||||
return singletonObject;
|
||||
}
|
||||
if (locked) {
|
||||
throw ex;
|
||||
}
|
||||
// Try late locking for waiting on specific bean to be finished.
|
||||
this.singletonLock.lock();
|
||||
locked = true;
|
||||
|
||||
@@ -102,6 +102,8 @@ class BackgroundBootstrapTests {
|
||||
|
||||
@Bean
|
||||
public TestBean testBean1(ObjectProvider<TestBean> testBean3, ObjectProvider<TestBean> testBean4) {
|
||||
new Thread(testBean3::getObject).start();
|
||||
new Thread(testBean4::getObject).start();
|
||||
new Thread(testBean3::getObject).start();
|
||||
new Thread(testBean4::getObject).start();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user