Skip to content

Improve handling of mainThreadPrefix and remove redundant null check #34746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ protected void checkMergedBeanDefinition(RootBeanDefinition mbd, String beanName
@Override
protected @Nullable Boolean isCurrentThreadAllowedToHoldSingletonLock() {
String mainThreadPrefix = this.mainThreadPrefix;
if (this.mainThreadPrefix != null) {
if (mainThreadPrefix != null) {
// We only differentiate in the preInstantiateSingletons phase.

PreInstantiation preInstantiation = this.preInstantiationThread.get();
Expand All @@ -1069,7 +1069,7 @@ protected void checkMergedBeanDefinition(RootBeanDefinition mbd, String beanName
}
else if (this.strictLocking == null) {
// No explicit locking configuration -> infer appropriate locking.
if (mainThreadPrefix != null && !getThreadNamePrefix().equals(mainThreadPrefix)) {
if (!getThreadNamePrefix().equals(mainThreadPrefix)) {
// An unmanaged thread (assumed to be application-internal) with lenient locking,
// and not part of the same thread pool that provided the main bootstrap thread
// (excluding scenarios where we are hit by multiple external bootstrap threads).
Expand Down