You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "XComp (via GitHub)" <gi...@apache.org> on 2023/04/19 15:04:34 UTC

[GitHub] [flink] XComp commented on a diff in pull request #22422: [FLINK-31838][runtime] Moves thread handling for leader event listener calls from DefaultMultipleComponentLeaderElectionService into DefaultLeaderElectionService

XComp commented on code in PR #22422:
URL: https://github.com/apache/flink/pull/22422#discussion_r1171481171


##########
flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionEventHandler.java:
##########
@@ -36,14 +37,44 @@ public interface LeaderElectionEventHandler {
      * Called by specific {@link LeaderElectionDriver} when the leadership is granted.
      *
      * @param newLeaderSessionId the valid leader session id
+     * @param executorService the {@link ExecutorService} this call should be executed on.
      */
-    void onGrantLeadership(UUID newLeaderSessionId);
+    void onGrantLeadershipAsync(UUID newLeaderSessionId, ExecutorService executorService);
+
+    /**
+     * Called by specific {@link LeaderElectionDriver} when the leadership is granted.
+     *
+     * @param newLeaderSessionId the valid leader session id
+     */
+    void onGrantLeadershipAsync(UUID newLeaderSessionId);

Review Comment:
   You're right - iterating over this change once more makes me realize that it's a bad proposal. The directExecutor doesn't need to be specified through a parameter. Instead, we could keep `onGrantLeadership(UUID)` (analogously for the other methods) to call the logic synchronously. This can be used by the legacy `LeaderElectionDriver` implementations.
   
   The asynchronous call that's going to be triggered from the `DefaultMultipleComponentLeaderElectionService` could be named something like `forwardGrantLeadershipEvent(UUID)` (analogously for the other methods). In its JavaDoc we have to define that this method is expected to run in a separate thread.
   
   I'm gonna go ahead a work on a commit adjusting the interface tomorrow.



-- 
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-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org