cadonna commented on PR #14598: URL: https://github.com/apache/kafka/pull/14598#issuecomment-1785652776
@kirktrue While I agree having a complete object at construction time is something worth pursuing, in this specific case the completion callback references the unsent request object. An example for the callback is: ```java unsentRequest.future().whenComplete((clientResponse, throwable) -> { if (clientResponse != null) { FindCoordinatorResponse response = (FindCoordinatorResponse) clientResponse.responseBody(); onResponse(clientResponse.receivedTimeMs(), response); } else { onFailedResponse(unsentRequest.handler().completionTimeMs(), throwable); } }); ``` Note that in the `else`-branch we need the reference to unsent request. As far as I understand the usages of the constructor with the callback misses the `else`-branch (i.e. the check for the absence of the response) which is a bug according to https://issues.apache.org/jira/browse/KAFKA-15562. That check will most likely contain a reference to the unsent request. So I think with fixing KAFKA-15562, the constructor with the callback will become obsolete. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org