ok2c commented on code in PR #728:
URL:
https://github.com/apache/httpcomponents-client/pull/728#discussion_r2594736146
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java:
##########
@@ -184,35 +206,34 @@ public Cancellable connectEndpoint(
}
final HttpRoute route = endpoint.route;
final RequestConfig requestConfig =
context.getRequestConfigOrDefault();
- @SuppressWarnings("deprecation")
- final Timeout connectTimeout = requestConfig.getConnectTimeout();
+ @SuppressWarnings("deprecation") final Timeout connectTimeout =
requestConfig.getConnectTimeout();
Review Comment:
@arturobernalg There is again plenty of white space / formatting noise.
Please try to avoid it.
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java:
##########
@@ -246,10 +267,64 @@ public EndpointInfo getEndpointInfo() {
return null;
}
+ private boolean tryAcquireSlot() {
+ if (sharedQueued == null) {
+ return true;
+ }
+ for (; ; ) {
+ final int q = sharedQueued.get();
+ if (q >= maxQueued) {
+ return false;
+ }
+ if (sharedQueued.compareAndSet(q, q + 1)) {
+ return true;
+ }
+ }
+ }
+
+ private void releaseSlot() {
+ if (sharedQueued != null) {
+ sharedQueued.decrementAndGet();
+ }
+ }
+
+ private AsyncClientExchangeHandler guard(final AsyncClientExchangeHandler
handler) {
Review Comment:
@arturobernalg I am not super crazy about code re-use at all cost but in
this case there is just too much duplicate code. Please consider extracting
into a separate proxy class similar to `RequestEntityProxy` /
`ResponseEntityProxy`
--
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]