Skip to content

Avoid full singleton lock for DefaultSingletonBeanRegistry.getSingleton(beanName, false) #25667

@jhoeller

Description

@jhoeller

Following up on the latest comments in #13117, DefaultSingletonBeanRegistry.getSingleton(beanName, false) seems to have a specific issue when called from isSingleton and isTypeMatch checks in AbstractBeanFactory: When isSingletonCurrentlyInCreation returns true, we're trying to enter the global lock for an early singleton exposure check... even if we're not allowed to create early references, so only able to check for an existing early reference. By turning earlySingletonObjects into a ConcurrentHashMap and separating that early reference existence check from the creation of early references (which needs to happen within the global lock), we could potentially address a whole range of issues for lookup attempts in concurrent singleton creation scenarios.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions