133tosakarin commented on code in PR #1154:
URL: https://github.com/apache/ratis/pull/1154#discussion_r1776179990
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RoleInfo.java:
##########
@@ -47,7 +47,7 @@ class RoleInfo {
public static final Logger LOG = LoggerFactory.getLogger(RoleInfo.class);
private final RaftPeerId id;
- private volatile RaftPeerRole role;
+ private final AtomicReference<RaftPeerRole> role = new AtomicReference<>();
Review Comment:
Volatile feels that it is necessary to ensure the safety of multi-threaded
concurrent access to RaftPeerRole. If the leader's state is checked in
LogAppender.isRunning (), concurrent safe access to RaftPeerRole is necessary
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]