@ -303,26 +303,29 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
@@ -303,26 +303,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 ;