zentol commented on code in PR #22380:
URL: https://github.com/apache/flink/pull/22380#discussion_r1169834323


##########
flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/TestingLeaderElectionDriver.java:
##########
@@ -70,22 +77,37 @@ public LeaderInformation getLeaderInformation() {
     }
 
     public void isLeader() {
+        isLeader(FutureUtils.completedVoidFuture());
+    }
+
+    public void isLeader(CompletableFuture<Void> grantLeadershipFuture) {
         synchronized (lock) {
             isLeader.set(true);
-            leaderElectionEventHandler.onGrantLeadership(UUID.randomUUID());
+            grantLeadershipFuture.thenRun(
+                    () -> 
leaderElectionEventHandler.onGrantLeadership(UUID.randomUUID()));

Review Comment:
   If thread-safety must be handled by the LeaderElectionEventHandler, then 
shall we document it as such in the javadocs?



-- 
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]

Reply via email to