You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2022/02/21 11:11:29 UTC

[httpcomponents-client] 02/06: Add @since 5.2 tag and make symmetric changes to H2AsyncClientBuilder

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 8c4777d3b098e80be7c8bf629e09199c421fd558
Author: Christophe <ch...@localhost>
AuthorDate: Fri Feb 18 14:52:57 2022 +0100

    Add @since 5.2 tag and make symmetric changes to H2AsyncClientBuilder
---
 .../hc/client5/http/impl/async/H2AsyncClientBuilder.java   | 14 +++++++++++++-
 .../hc/client5/http/impl/async/HttpAsyncClientBuilder.java |  4 +++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
index 61a73a1..590d4c3 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
@@ -102,6 +102,7 @@ import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
 import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.IOReactorConfig;
 import org.apache.hc.core5.reactor.IOSession;
+import org.apache.hc.core5.reactor.IOSessionListener;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.TimeValue;
 import org.apache.hc.core5.util.VersionInfo;
@@ -171,6 +172,7 @@ public class H2AsyncClientBuilder {
     }
 
     private IOReactorConfig ioReactorConfig;
+    private IOSessionListener ioSessionListener;
     private H2Config h2Config;
     private CharCodingConfig charCodingConfig;
     private SchemePortResolver schemePortResolver;
@@ -240,6 +242,16 @@ public class H2AsyncClientBuilder {
     }
 
     /**
+     * Sets {@link IOSessionListener} listener.
+     * 
+     * @since 5.2
+     */
+    public final H2AsyncClientBuilder setIOSessionListener(final IOSessionListener ioSessionListener) {
+        this.ioSessionListener = ioSessionListener;
+        return this;
+    }
+    
+    /**
      * Sets {@link CharCodingConfig} configuration.
      */
     public final H2AsyncClientBuilder setCharCodingConfig(final CharCodingConfig charCodingConfig) {
@@ -764,7 +776,7 @@ public class H2AsyncClientBuilder {
                 threadFactory != null ? threadFactory : new DefaultThreadFactory("httpclient-dispatch", true),
                 ioSessionDecorator != null ? ioSessionDecorator : LoggingIOSessionDecorator.INSTANCE,
                 ioReactorExceptionCallback != null ? ioReactorExceptionCallback : LoggingExceptionCallback.INSTANCE,
-                null,
+                ioSessionListener,
                 ioSession -> ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE));
 
         if (execInterceptors != null) {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
index 5d76499..8fb1714 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
@@ -322,7 +322,9 @@ public class HttpAsyncClientBuilder {
     }
     
     /**
-     * Sets {@link IOSessionListenerfig} listener.
+     * Sets {@link IOSessionListener} listener.
+     * 
+     * @since 5.2
      */
     public final HttpAsyncClientBuilder setIOSessionListener(final IOSessionListener ioSessionListener) {
         this.ioSessionListener = ioSessionListener;