Vyacheslav Koptilin created IGNITE-17493:
--------------------------------------------
Summary: CMG service should use onLeaderElected callback in order
to detect the fact that current node is a leader
Key: IGNITE-17493
URL: https://issues.apache.org/jira/browse/IGNITE-17493
Project: Ignite
Issue Type: Improvement
Reporter: Vyacheslav Koptilin
CmgRaftService service should use onLeaderElected callback in order to detect
the fact that current node is a leader.
{code:java}
/**
* Returns {@code true} if the current node is the CMG leader.
*
* @return {@code true} if the current node is the CMG leader.
*/
// TODO: replace with onLeaderElected callback after
https://issues.apache.org/jira/browse/IGNITE-16379 is implemented
public CompletableFuture<Boolean> isCurrentNodeLeader() {
ClusterNode thisNode = clusterService.topologyService().localMember();
return leader().thenApply(thisNode::equals);
}
private CompletableFuture<ClusterNode> leader() {
return raftService.refreshLeader().thenApply(v ->
resolvePeer(raftService.leader()));
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)