reswqa commented on code in PR #22422: URL: https://github.com/apache/flink/pull/22422#discussion_r1172832237
########## flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionEventHandler.java: ########## @@ -39,12 +40,29 @@ public interface LeaderElectionEventHandler { */ void onGrantLeadership(UUID newLeaderSessionId); + /** + * Called by specific {@link LeaderElectionDriver} when the leadership is granted. + * + * <p>This method will trigger the grant event processing in a separate thread. + * + * @param newLeaderSessionId the valid leader session id + */ + CompletableFuture<Void> onGrantLeadershipAsync(UUID newLeaderSessionId); + /** * Called by specific {@link LeaderElectionDriver} when the leadership is revoked. Updating the * LeaderElection data at this point doesn't have any effect anymore. */ void onRevokeLeadership(); + /** + * Called by specific {@link LeaderElectionDriver} when the leadership is revoked. Updating the + * LeaderElection data at this point doesn't have any effect anymore. + * + * <p>This method will trigger the grant event processing in a separate thread. Review Comment: ```suggestion * <p>This method will trigger the revoke event processing in a separate thread. ``` ########## flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionEventHandler.java: ########## @@ -56,4 +74,18 @@ public interface LeaderElectionEventHandler { * address. */ void onLeaderInformationChange(LeaderInformation leaderInformation); + + /** + * Called by specific {@link LeaderElectionDriver} when the leader information is changed. Then + * the {@link LeaderElectionService} could write the leader information again if necessary. This + * method should only be called when {@link LeaderElectionDriver#hasLeadership()} is true. + * Duplicated leader change events could happen, so the implementation should check whether the + * passed leader information is really different with internal confirmed leader information. + * + * <p>This method * will trigger the grant event processing in a separate thread. Review Comment: ```suggestion * <p>This method will trigger the leader information change event processing in a separate thread. ``` -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org