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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zzoe2346
Copy link

This Pull Request refactors the isCurrentThreadAllowedToHoldSingletonLock method to improve the consistency of mainThreadPrefix variable usage and remove a redundant null check.

Changes

Consistent Variable Usage

  • After assigning the value of this.mainThreadPrefix to the local variable mainThreadPrefix at the beginning of the method, the subsequent if check now consistently uses the local variable (if (mainThreadPrefix != null) instead of if (this.mainThreadPrefix != null)).

Removed Redundant Null Check

  • The mainThreadPrefix != null check within the else if (this.strictLocking == null) block has been removed.
  • This check was redundant because if (maainThreadPrefix != null) condition has already passed, guaranteeing the variable is not null at that point.

I hope my PR useful :)
Thank you.

@zzoe2346 zzoe2346 changed the title Refactor: Improve mainThreadPrefix usage consistency and remove redundant check in isCurrentThreadAllowedToHoldSingletonLock method Refactor: Improve variable usage consistency and remove redundant check in isCurrentThreadAllowedToHoldSingletonLock method Apr 12, 2025
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 12, 2025
@zzoe2346 zzoe2346 changed the title Refactor: Improve variable usage consistency and remove redundant check in isCurrentThreadAllowedToHoldSingletonLock method Refactor: Improve variable usage consistency and remove redundant null check Apr 12, 2025
@sbrannen sbrannen requested a review from jhoeller April 15, 2025 10:52
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Apr 15, 2025
@sbrannen sbrannen changed the title Refactor: Improve variable usage consistency and remove redundant null check Improve handling of mainThreadPrefix and remove redundant null check Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants