You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2020/05/29 21:39:50 UTC

[pulsar] branch master updated: update asynchttpclient verison (#7087)

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

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new c281d95  update asynchttpclient verison (#7087)
c281d95 is described below

commit c281d95c1a9ad413d1eeb947a9da31b578be30d3
Author: Jia Zhai <zh...@apache.org>
AuthorDate: Sat May 30 05:39:40 2020 +0800

    update asynchttpclient verison (#7087)
    
    * update asynchttpclient verison
    
    * add default config for new version of asynchttp
    
    * update license version
    
    * fix ut
    
    * add default config for asynchttp to avoid npe
---
 distribution/server/src/assemble/LICENSE.bin.txt                 | 9 +++++----
 pom.xml                                                          | 6 ++++--
 .../org/apache/pulsar/client/api/BrokerServiceLookupTest.java    | 7 +++++--
 .../pulsar/client/admin/internal/http/AsyncHttpConnector.java    | 6 ++++--
 .../resources/org/asynchttpclient/config/ahc-default.properties  | 6 +++++-
 pulsar-client-tools-test/pom.xml                                 | 6 ++++++
 .../src/main/java/org/apache/pulsar/client/impl/HttpClient.java  | 7 +++++--
 pulsar-client/src/main/resources/ahc.properties                  | 5 ++++-
 pulsar-sql/presto-distribution/LICENSE                           | 9 +++++----
 9 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/distribution/server/src/assemble/LICENSE.bin.txt b/distribution/server/src/assemble/LICENSE.bin.txt
index c1b316a..999ef8c 100644
--- a/distribution/server/src/assemble/LICENSE.bin.txt
+++ b/distribution/server/src/assemble/LICENSE.bin.txt
@@ -326,7 +326,7 @@ The Apache Software License, Version 2.0
  * Guava
     - com.google.guava-guava-25.1-jre.jar
  * J2ObjC Annotations -- com.google.j2objc-j2objc-annotations-1.1.jar
- * Netty Reactive Streams -- com.typesafe.netty-netty-reactive-streams-2.0.0.jar
+ * Netty Reactive Streams -- com.typesafe.netty-netty-reactive-streams-2.0.4.jar
  * Swagger
     - io.swagger-swagger-annotations-1.5.21.jar
     - io.swagger-swagger-core-1.5.21.jar
@@ -362,6 +362,7 @@ The Apache Software License, Version 2.0
     - io.netty-netty-transport-native-epoll-4.1.48.Final.jar
     - io.netty-netty-transport-native-unix-common-4.1.48.Final.jar
     - io.netty-netty-transport-native-unix-common-4.1.48.Final-linux-x86_64.jar
+    - io.netty-netty-transport-native-kqueue-4.1.48.Final-osx-x86_64.jar
     - io.netty-netty-tcnative-boringssl-static-2.0.30.Final.jar
  * Prometheus client
     - io.prometheus-simpleclient-0.5.0.jar
@@ -409,8 +410,8 @@ The Apache Software License, Version 2.0
     - org.apache.bookkeeper.stats-codahale-metrics-provider-4.10.0.jar
  * LZ4 -- org.lz4-lz4-java-1.5.0.jar
  * AsyncHttpClient
-    - org.asynchttpclient-async-http-client-2.7.0.jar
-    - org.asynchttpclient-async-http-client-netty-utils-2.7.0.jar
+    - org.asynchttpclient-async-http-client-2.12.1.jar
+    - org.asynchttpclient-async-http-client-netty-utils-2.12.1.jar
  * Jetty
     - org.eclipse.jetty-jetty-client-9.4.20.v20190813.jar
     - org.eclipse.jetty-jetty-continuation-9.4.20.v20190813.jar
@@ -566,7 +567,7 @@ Eclipse Public License 1.0 -- licenses/LICENSE-AspectJ.txt
     - org.aspectj-aspectjweaver-1.9.2.jar
 
 Public Domain (CC0) -- licenses/LICENSE-CC0.txt
- * Reactive Streams -- org.reactivestreams-reactive-streams-1.0.2.jar
+ * Reactive Streams -- org.reactivestreams-reactive-streams-1.0.3.jar
 
 Creative Commons Attribution License
  * Jcip -- licenses/LICENSE-jcip.txt
diff --git a/pom.xml b/pom.xml
index a1080c1..e7e6e5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -216,6 +216,8 @@ flexible messaging model and an intuitive client API.</description>
     <prometheus-jmx.version>0.12.0</prometheus-jmx.version>
     <confluent.version>5.3.2</confluent.version>
     <kafka-avro-convert-jackson.version>1.9.13</kafka-avro-convert-jackson.version>
+    <httpcomponents.version>4.5.5</httpcomponents.version>
+    <asynchttpclient.version>2.12.1</asynchttpclient.version>
 
     <!-- test dependencies -->
     <cassandra.version>3.6.0</cassandra.version>
@@ -245,7 +247,7 @@ flexible messaging model and an intuitive client API.</description>
       <dependency>
         <groupId>org.asynchttpclient</groupId>
         <artifactId>async-http-client</artifactId>
-        <version>2.7.0</version>
+        <version>${asynchttpclient.version}</version>
         <exclusions>
           <exclusion>
             <groupId>io.netty</groupId>
@@ -257,7 +259,7 @@ flexible messaging model and an intuitive client API.</description>
       <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <artifactId>httpclient</artifactId>
-        <version>4.5.5</version>
+        <version>${httpcomponents.version}</version>
       </dependency>
 
       <dependency>
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
index 0e926af..68925e0 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
@@ -39,6 +39,7 @@ import java.io.InputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
@@ -1155,9 +1156,11 @@ public class BrokerServiceLookupTest extends ProducerConsumerBase {
         confBuilder.setUserAgent(version);
         confBuilder.setKeepAliveStrategy(new DefaultKeepAliveStrategy() {
             @Override
-            public boolean keepAlive(Request ahcRequest, HttpRequest request, HttpResponse response) {
+            public boolean keepAlive(InetSocketAddress remoteAddress, Request ahcRequest,
+                                     HttpRequest request, HttpResponse response) {
                 // Close connection upon a server error or per HTTP spec
-                return (response.status().code() / 100 != 5) && super.keepAlive(ahcRequest, request, response);
+                return (response.status().code() / 100 != 5)
+                       && super.keepAlive(remoteAddress, ahcRequest, request, response);
             }
         });
         AsyncHttpClientConfig config = confBuilder.build();
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
index 0d3f132..eca1800 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
@@ -104,9 +104,11 @@ public class AsyncHttpConnector implements Connector {
         confBuilder.setIoThreadsCount(conf.getNumIoThreads());
         confBuilder.setKeepAliveStrategy(new DefaultKeepAliveStrategy() {
             @Override
-            public boolean keepAlive(Request ahcRequest, HttpRequest request, HttpResponse response) {
+            public boolean keepAlive(InetSocketAddress remoteAddress, Request ahcRequest,
+                                     HttpRequest request, HttpResponse response) {
                 // Close connection upon a server error or per HTTP spec
-                return (response.status().code() / 100 != 5) && super.keepAlive(ahcRequest, request, response);
+                return (response.status().code() / 100 != 5)
+                       && super.keepAlive(remoteAddress, ahcRequest, request, response);
             }
         });
 
diff --git a/pulsar-client-admin/src/main/resources/org/asynchttpclient/config/ahc-default.properties b/pulsar-client-admin/src/main/resources/org/asynchttpclient/config/ahc-default.properties
index fa74eb6..0396933 100644
--- a/pulsar-client-admin/src/main/resources/org/asynchttpclient/config/ahc-default.properties
+++ b/pulsar-client-admin/src/main/resources/org/asynchttpclient/config/ahc-default.properties
@@ -70,4 +70,8 @@ org.asynchttpclient.shutdownTimeout=15000
 org.asynchttpclient.useNativeTransport=false
 org.asynchttpclient.ioThreadsCount=0
 org.asynchttpclient.acquireFreeChannelTimeout=0
-org.asynchttpclient.enableWebSocketCompression=true
\ No newline at end of file
+org.asynchttpclient.enableWebSocketCompression=true
+org.asynchttpclient.expiredCookieEvictionDelay=30000
+org.asynchttpclient.hashedWheelTimerTickDuration=100
+org.asynchttpclient.hashedWheelTimerSize=512
+
diff --git a/pulsar-client-tools-test/pom.xml b/pulsar-client-tools-test/pom.xml
index 2270c0f..9116f7d 100644
--- a/pulsar-client-tools-test/pom.xml
+++ b/pulsar-client-tools-test/pom.xml
@@ -57,6 +57,12 @@
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>bouncy-castle-bc</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java
index 3e693ad..0b4ef32 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java
@@ -21,6 +21,7 @@ package org.apache.pulsar.client.impl;
 import java.io.Closeable;
 import java.io.IOException;
 import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
 import java.net.URI;
 import java.net.URL;
 import java.util.Map;
@@ -76,9 +77,11 @@ public class HttpClient implements Closeable {
         confBuilder.setUserAgent(String.format("Pulsar-Java-v%s", PulsarVersion.getVersion()));
         confBuilder.setKeepAliveStrategy(new DefaultKeepAliveStrategy() {
             @Override
-            public boolean keepAlive(Request ahcRequest, HttpRequest request, HttpResponse response) {
+            public boolean keepAlive(InetSocketAddress remoteAddress, Request ahcRequest,
+                                     HttpRequest request, HttpResponse response) {
                 // Close connection upon a server error or per HTTP spec
-                return (response.status().code() / 100 != 5) && super.keepAlive(ahcRequest, request, response);
+                return (response.status().code() / 100 != 5)
+                       && super.keepAlive(remoteAddress, ahcRequest, request, response);
             }
         });
 
diff --git a/pulsar-client/src/main/resources/ahc.properties b/pulsar-client/src/main/resources/ahc.properties
index 9a23d91..71877cb 100644
--- a/pulsar-client/src/main/resources/ahc.properties
+++ b/pulsar-client/src/main/resources/ahc.properties
@@ -70,4 +70,7 @@ org.apache.pulsar.shade.org.asynchttpclient.shutdownTimeout=15000
 org.apache.pulsar.shade.org.asynchttpclient.useNativeTransport=false
 org.apache.pulsar.shade.org.asynchttpclient.ioThreadsCount=0
 org.apache.pulsar.shade.org.asynchttpclient.acquireFreeChannelTimeout=0
-org.apache.pulsar.shade.org.org.asynchttpclient.enableWebSocketCompression=true
\ No newline at end of file
+org.apache.pulsar.shade.org.org.asynchttpclient.enableWebSocketCompression=true
+org.apache.pulsar.shade.org.asynchttpclient.expiredCookieEvictionDelay=30000
+org.apache.pulsar.shade.org.asynchttpclient.hashedWheelTimerTickDuration=100
+org.apache.pulsar.shade.org.asynchttpclient.hashedWheelTimerSize=512
diff --git a/pulsar-sql/presto-distribution/LICENSE b/pulsar-sql/presto-distribution/LICENSE
index 73a9ca8..d4fca40 100644
--- a/pulsar-sql/presto-distribution/LICENSE
+++ b/pulsar-sql/presto-distribution/LICENSE
@@ -239,7 +239,7 @@ The Apache Software License, Version 2.0
     - netty-common-4.1.48.Final.jar
     - netty-handler-4.1.48.Final.jar
     - netty-handler-proxy-4.1.48.Final.jar
-    - netty-reactive-streams-2.0.0.jar
+    - netty-reactive-streams-2.0.4.jar
     - netty-resolver-4.1.48.Final.jar
     - netty-resolver-dns-4.1.48.Final.jar
     - netty-tcnative-boringssl-static-2.0.30.Final.jar
@@ -248,6 +248,7 @@ The Apache Software License, Version 2.0
     - netty-transport-native-epoll-4.1.48.Final-linux-x86_64.jar
     - netty-transport-native-unix-common-4.1.48.Final.jar
     - netty-transport-native-unix-common-4.1.48.Final-linux-x86_64.jar
+    - netty-transport-native-kqueue-4.1.48.Final-osx-x86_64.jar
  * Joda Time
     - joda-time-2.9.9.jar
     - joda-time-2.10.1.jar
@@ -404,8 +405,8 @@ The Apache Software License, Version 2.0
   * JCTools
     - jctools-core-2.1.2.jar
   * Asynchronous Http Client
-    - async-http-client-2.7.0.jar
-    - async-http-client-netty-utils-2.7.0.jar
+    - async-http-client-2.12.1.jar
+    - async-http-client-netty-utils-2.12.1.jar
   * Apache Bookkeeper
     - bookkeeper-common-4.10.0.jar
     - bookkeeper-common-allocator-4.10.0.jar
@@ -544,7 +545,7 @@ Public Domain (CC0) -- licenses/LICENSE-CC0.txt
  * AOP Alliance
    - aopalliance-1.0.jar
  * Reactive Streams
-    - reactive-streams-1.0.2.jar
+    - reactive-streams-1.0.3.jar
 
 Creative Commons Attribution License
  * Jcip -- licenses/LICENSE-jcip.txt