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


##########
flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/DefaultLeaderElectionService.java:
##########
@@ -189,66 +179,62 @@ protected void register(String contenderID, 
LeaderContender contender) throws Ex
         checkNotNull(contender, "Contender must not be null.");
 
         synchronized (lock) {
-            Preconditions.checkState(
-                    leaderContender == null,
-                    "Only one LeaderContender is allowed to be registered to 
this service.");
-            Preconditions.checkState(
-                    this.contenderID == null, "The contenderID is only allowed 
to be set once.");
             Preconditions.checkState(
                     running,
                     "The DefaultLeaderElectionService should have established 
a connection to the backend before it's started.");
 
-            leaderContender = contender;
-            this.contenderID = contenderID;
+            leaderContenderRegistry.put(contenderID, contender);

Review Comment:
   > Side-question: Are there any safeguards that there is at most 1 contender 
for a given leadership role?
   This is mostly relevant for testing of course; but what would happen if 2 
JMs would use the same LES? They'd both become leader?
   
   That's essentially the safe-guard you were talking about in your [general 
review 
comment](https://github.com/apache/flink/pull/22844#pullrequestreview-1511266413)



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