ok2c commented on code in PR #592:
URL: 
https://github.com/apache/httpcomponents-core/pull/592#discussion_r2658018764


##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2MultiplexingRequester.java:
##########
@@ -245,6 +254,16 @@ public void failed(final Exception cause) {
                             }
 
                         };
+                        final int max = maxRequestsPerConnection;
+                        if (max > 0) {
+                            final int current = 
ioSession.getPendingCommandCount();
+                            if (current >= 0 && current >= max) {
+                                exchangeHandler.failed(new 
RejectedExecutionException(
+                                        "Maximum number of pending requests 
per connection reached (max=" + max + ")"));

Review Comment:
   @arturobernalg Same as above. Let say "command" instead of "request" here



##########
httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2MaxRequestsPerConnectionLocalExample.java:
##########
@@ -0,0 +1,245 @@
+/*

Review Comment:
   @arturobernalg Let's drop all examples and integration tests. They look 
heavy and require a specially crafted server side listener. I wish we had unit 
test coverage for `HttpAsyncRequester` / `H2MultiplexingRequester` but we do 
not.
   
   This functionality can have integration tests and examples in client along 
with other client request per connection policy configuration. 



##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2MultiplexingRequester.java:
##########
@@ -87,6 +88,12 @@ public class H2MultiplexingRequester extends AsyncRequester {
 
     private final H2ConnPool connPool;
 
+    /**
+     * Hard cap on per-connection queued / in-flight requests.

Review Comment:
   @arturobernalg Let's use the term "command" instead of "request" here to 
make sure there is no confusion with HTTP requests. 



##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2MultiplexingRequesterBootstrap.java:
##########
@@ -76,6 +77,8 @@ public class H2MultiplexingRequesterBootstrap {
 
     private IOReactorMetricsListener threadPoolListener;
 
+    private int maxRequestsPerConnection;

Review Comment:
   @arturobernalg Same.



-- 
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]

Reply via email to