Skip to content

[Enhancement] Remove the volatile declaration for the two variables requestsWrite and requestsRead in the GroupCommitService class #9491

Open
@huanzhikang

Description

@huanzhikang

Before Creating the Enhancement Request

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

Summary

Remove the volatile declaration for the two variables requestsWrite and requestsRead in the GroupCommitService class.

Reasons:

The variable requestsRead is only used within the GroupCommitService thread, so visibility is not required, and it does not need to be declared as volatile.

The code that uses the requestsWrite object is all between lock and unlock operations. The CAS (Compare-And-Swap) operations in lock and unlock have the memory semantics of volatile read and write, which already ensures the visibility of the requestsWrite object reference. Therefore, it also does not need to be declared as volatile.

Motivation

Reomve unneeded volatile declarations

Describe the Solution You'd Like

Remove the volatile declaration for the two variables requestsWrite and requestsRead in the GroupCommitService class

Describe Alternatives You've Considered

Remove the volatile declaration for the two variables requestsWrite and requestsRead in the GroupCommitService class

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions