rschmitt commented on code in PR #788:
URL:
https://github.com/apache/httpcomponents-client/pull/788#discussion_r2699687419
##########
httpclient5/src/main/java/org/apache/hc/client5/http/protocol/HttpClientContext.java:
##########
@@ -466,6 +467,18 @@ public void setExchangeId(final String exchangeId) {
this.exchangeId = exchangeId;
}
+ /**
+ * @since 5.7
+ */
+ public String setExchangeId(final Supplier<String> supplier) {
+ final String exchangeId = this.exchangeId; // avoid getfield opcode
+ if (exchangeId == null) {
+ return this.exchangeId = supplier.get();
+ } else {
+ return exchangeId;
+ }
+ }
Review Comment:
This looks incoherent. I'd expect the client builders to simply take a
`Supplier<String> exchangeIdSupplier`, which defaults to
`ExecSupport::getNextExchangeId`. The context classes shouldn't need to know
about what supplies the exchange IDs, they should just know the exchange ID for
the particular exchange they represent.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]