This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new e7ded6791 [fix]change HttpShenyuSdkClient#CloseableHttpAsyncClient be
global resources(#3925) (#4190)
e7ded6791 is described below
commit e7ded67919e01cd7320fd5dee85ab063fb7ccb35
Author: 杨文杰 <[email protected]>
AuthorDate: Tue Nov 15 18:07:58 2022 +0800
[fix]change HttpShenyuSdkClient#CloseableHttpAsyncClient be global
resources(#3925) (#4190)
* change HttpShenyuSdkClient#CloseableHttpAsyncClient be global resources
* change HttpShenyuSdkClient#CloseableHttpAsyncClient be global resources
---
.../java/org/apache/shenyu/sdk/httpclient/HttpShenyuSdkClient.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/shenyu-sdk/shenyu-sdk-httpclient/src/main/java/org/apache/shenyu/sdk/httpclient/HttpShenyuSdkClient.java
b/shenyu-sdk/shenyu-sdk-httpclient/src/main/java/org/apache/shenyu/sdk/httpclient/HttpShenyuSdkClient.java
index 30218bea9..55bdfe5a1 100644
---
a/shenyu-sdk/shenyu-sdk-httpclient/src/main/java/org/apache/shenyu/sdk/httpclient/HttpShenyuSdkClient.java
+++
b/shenyu-sdk/shenyu-sdk-httpclient/src/main/java/org/apache/shenyu/sdk/httpclient/HttpShenyuSdkClient.java
@@ -67,6 +67,8 @@ public class HttpShenyuSdkClient extends
AbstractShenyuSdkClient {
private RequestConfig requestConfig;
+ private HttpAsyncClient httpAsyncClient;
+
@Override
protected void initClient(final Properties props) {
try {
@@ -88,6 +90,7 @@ public class HttpShenyuSdkClient extends
AbstractShenyuSdkClient {
.setConnectTimeout(Integer.parseInt(serverResponseTimeOut))
.setConnectionRequestTimeout(Integer.parseInt(connectionRequestTimeOut))
.build();
+ this.httpAsyncClient = getHttpClient();
} catch (Exception e) {
throw new ShenyuException(e);
}
@@ -143,8 +146,7 @@ public class HttpShenyuSdkClient extends
AbstractShenyuSdkClient {
requestBuilder.addHeader(name, value);
}
}
-
- Future<HttpResponse> execute =
getHttpClient().execute(requestBuilder.build(), new
FutureCallback<HttpResponse>() {
+ Future<HttpResponse> execute =
httpAsyncClient.execute(requestBuilder.build(), new
FutureCallback<HttpResponse>() {
@Override
public void completed(final HttpResponse response) {
LOG.debug("HttpResponse completed statusLine={}",
response.getStatusLine());