Skip to content
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

[Enhancement] The variables hasNotified whether can declared without the volatile keyword? #8069

Open
1 task done
KimZhangJinMing opened this issue Apr 26, 2024 · 0 comments

Comments

@KimZhangJinMing
Copy link

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Summary

In class ServiceThread. The variables hasNotified has been declared as AtomicBoolean. This is ensure the visibility, whether can declared without the volatile?
protected volatile AtomicBoolean hasNotified = new AtomicBoolean(false);

Motivation

This maybe cause confuse when view the source code.

Describe the Solution You'd Like

protected AtomicBoolean hasNotified = new AtomicBoolean(false);

Describe Alternatives You've Considered

None.

Additional Context

No response

@KimZhangJinMing KimZhangJinMing changed the title [Enhancement] ServiceThread类中hasNotified是不是不需要volatile了? [Enhancement] The variables hasNotified whether can declared without the volatile keyword? Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant