gnodet-bot commented on code in PR #27613:
URL: https://github.com/apache/camel/pull/27613#discussion_r4230318940
##########
components/camel-jgroups-raft/src/main/java/org/apache/camel/component/jgroups/raft/cluster/ClusterRoleChangeListener.java:
##########
@@ -46,14 +46,17 @@ public void roleChanged(Role role) {
}
break;
case Follower:
+ case Learner:
if (jgroupsRaftClusterView.isMaster()) {
jgroupsRaftClusterView.setMaster(false);
jgroupsRaftClusterView.fireLeadershipChangedEvent((CamelClusterMember) null);
Review Comment:
💡 **Minor note:** `fireLeadershipChangedEvent()` is called here with the
`isMaster` flag already mutated on the preceding line. If
`fireLeadershipChangedEvent()` throws, the flag stays `false` but listeners may
not have been notified — a pre-existing risk that this PR doesn't introduce.
Worth noting that `RAFT.notifyRoleChangeListeners` catches `Throwable` and
logs, so an unchecked exception from this path would be silently absorbed by
the framework.
No action required for this PR, but if robust notification delivery matters
long-term, a try/finally to restore `isMaster` on failure could be considered.
--
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]