|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2024 the original author or authors. |
|
|
|
* Copyright 2002-2025 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -178,13 +178,13 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
protected Object getSingleton(String beanName, boolean allowEarlyReference) { |
|
|
|
protected Object getSingleton(String beanName, boolean allowEarlyReference) { |
|
|
|
// Quick check for existing instance without full singleton lock
|
|
|
|
// Quick check for existing instance without full singleton lock.
|
|
|
|
Object singletonObject = this.singletonObjects.get(beanName); |
|
|
|
Object singletonObject = this.singletonObjects.get(beanName); |
|
|
|
if (singletonObject == null && isSingletonCurrentlyInCreation(beanName)) { |
|
|
|
if (singletonObject == null && isSingletonCurrentlyInCreation(beanName)) { |
|
|
|
singletonObject = this.earlySingletonObjects.get(beanName); |
|
|
|
singletonObject = this.earlySingletonObjects.get(beanName); |
|
|
|
if (singletonObject == null && allowEarlyReference) { |
|
|
|
if (singletonObject == null && allowEarlyReference) { |
|
|
|
synchronized (this.singletonObjects) { |
|
|
|
synchronized (this.singletonObjects) { |
|
|
|
// Consistent creation of early reference within full singleton lock
|
|
|
|
// Consistent creation of early reference within full singleton lock.
|
|
|
|
singletonObject = this.singletonObjects.get(beanName); |
|
|
|
singletonObject = this.singletonObjects.get(beanName); |
|
|
|
if (singletonObject == null) { |
|
|
|
if (singletonObject == null) { |
|
|
|
singletonObject = this.earlySingletonObjects.get(beanName); |
|
|
|
singletonObject = this.earlySingletonObjects.get(beanName); |
|
|
|
|