ok2c commented on code in PR #592:
URL:
https://github.com/apache/httpcomponents-core/pull/592#discussion_r2653424732
##########
httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java:
##########
@@ -96,6 +96,27 @@ enum Status {
*/
void enqueue(Command command, Command.Priority priority);
+ /**
+ * Returns the number of enqueued commands pending execution.
+ *
+ * @since 5.5
+ */
+ default int getPendingCommandCount() {
+ return 0;
Review Comment:
@arturobernalg I think the method by default return -1 as `not known`
##########
httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java:
##########
@@ -96,6 +96,27 @@ enum Status {
*/
void enqueue(Command command, Command.Priority priority);
+ /**
+ * Returns the number of enqueued commands pending execution.
+ *
+ * @since 5.5
+ */
+ default int getPendingCommandCount() {
+ return 0;
+ }
+
+ /**
+ * Inserts {@link Command} at the end of the command queue if the number of
+ * enqueued commands pending execution is below the provided maximum.
+ *
+ * @return {@code true} if the command was enqueued, {@code false}
otherwise.
+ * @since 5.5
+ */
+ default boolean enqueue(final Command command, final Command.Priority
priority, final int maxPendingCommands) {
Review Comment:
@arturobernalg I would not do that on the i/o session level. Different
protocol handlers may have different restrictions. 10 concurrent requests may
be perfectly OK for HTTP/2 and too much for HTTP/1.1. Please move this logic to
individual protocol handlers.
--
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]