Skip to content

Commit

Permalink
add code comment to expain why add a recursive call
Browse files Browse the repository at this point in the history
  • Loading branch information
poorbarcode committed Nov 1, 2023
1 parent 585ae8b commit f7aa64f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,12 @@ private CompletableFuture<Void> tryOverwriteOldProducer(Producer oldProducer, Pr
"Producer with name '" + newProducer.getProducerName()
+ "' is already connected to topic"));
} else {
// If the connection of the previous producer is not active, the method
// "cnx().checkConnectionLiveness()" will trigger the close for it and kick off the previous
// producer. So try to add current producer again.
// The recursive call will be stopped by these two case(This prevents infinite call):
// 1. add current producer success.
// 2. once another same name producer registered.
return internalAddProducer(newProducer);
}
});
Expand Down

0 comments on commit f7aa64f

Please sign in to comment.