You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksandr Polovtcev (Jira)" <ji...@apache.org> on 2022/09/23 06:58:00 UTC

[jira] [Updated] (IGNITE-17493) CMG service should use onLeaderElected callback in order to detect the fact that current node is a leader

     [ https://issues.apache.org/jira/browse/IGNITE-17493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksandr Polovtcev updated IGNITE-17493:
-----------------------------------------
    Epic Link: IGNITE-15114

> 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
>            Assignee: Aleksandr Polovtcev
>            Priority: Major
>              Labels: ignite-3
>
> 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)