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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]