You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vyacheslav Koptilin (Jira)" <ji...@apache.org> on 2022/08/08 17:26:00 UTC
[jira] [Created] (IGNITE-17493) CMG service should use onLeaderElected callback in order to detect the fact that current node is a leader
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)