smjn commented on code in PR #17772:
URL: https://github.com/apache/kafka/pull/17772#discussion_r1837751641
##########
share/src/main/java/org/apache/kafka/server/share/persister/DefaultStatePersister.java:
##########
@@ -211,7 +228,8 @@ private ReadShareGroupStateResult readResponsesToResult(
int partition = partitionFuture.getKey();
CompletableFuture<ReadShareGroupStateResponse> future
= partitionFuture.getValue();
try {
- ReadShareGroupStateResponse partitionResponse =
future.get();
+ // already completed because of allOf call in the
caller
+ ReadShareGroupStateResponse partitionResponse =
future.get(0, TimeUnit.MILLISECONDS);
Review Comment:
@apoorvmittal10
Yes, this is what is happening in the call to this util method. It happens
like this:
```
CompletableFuture<Void> combinedFuture = CompletableFuture.allOf(...);
return combinedFuture.thenApply(v -> readResponsesToResult(futureMap));
```
`allOff` returns a future which will be completed when all underlying
futures complete. However, we do not want to wait for this and hence
immediately return the `future.thenApply` result. The futures which thenApply
will receive will have been completed.
Code ref:
https://github.com/apache/kafka/blob/trunk/share/src/main/java/org/apache/kafka/server/share/persister/DefaultStatePersister.java#L195
--
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]