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

Roman Puchkovskiy updated IGNITE-17493:
---------------------------------------
    Reviewer: Roman Puchkovskiy

> 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
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to