Skip to content

Commit 358dc27

Browse files
authored
MINOR: Ensure proper visibility of attribute accesses across threads (#21014)
I found those two cases while working in this area. In both cases, they are read by multiple threads so they must either be volatile or acquiring the appropriate lock. Using volatile is fine here. Reviewers: Lianet Magrans <lmagrans@confluent.io>
1 parent 5cfb17d commit 358dc27

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntime.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ class CoordinatorContext {
578578
/**
579579
* The current state.
580580
*/
581-
CoordinatorState state;
581+
volatile CoordinatorState state;
582582

583583
/**
584584
* The current epoch of the coordinator. This represents

group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public GroupCoordinatorService build() {
345345
* The metadata image to extract topic id to names map.
346346
* This is initialised when the {@link GroupCoordinator#onNewMetadataImage(CoordinatorMetadataImage, CoordinatorMetadataDelta)} is called
347347
*/
348-
private CoordinatorMetadataImage metadataImage = null;
348+
private volatile CoordinatorMetadataImage metadataImage = null;
349349

350350
/**
351351
*

0 commit comments

Comments
 (0)