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 2023/11/30 12:35:47 UTC
(httpcomponents-client) branch master updated: Added missing #disconnectEndpoint method to AsyncConnectExec
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
The following commit(s) were added to refs/heads/master by this push:
new a46c9e565 Added missing #disconnectEndpoint method to AsyncConnectExec
a46c9e565 is described below
commit a46c9e56568b67cff95454c60daf80f3b14c4319
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Nov 30 13:21:52 2023 +0100
Added missing #disconnectEndpoint method to AsyncConnectExec
---
.../java/org/apache/hc/client5/http/async/AsyncExecRuntime.java | 5 +++++
.../hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java | 8 ++++++++
.../hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java | 8 ++++++++
3 files changed, 21 insertions(+)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecRuntime.java
index 237a5e264..a82c778dd 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecRuntime.java
@@ -106,6 +106,11 @@ public interface AsyncExecRuntime {
HttpClientContext context,
FutureCallback<AsyncExecRuntime> callback);
+ /**
+ * Disconnects the local endpoint from the initial hop in the connection route.
+ */
+ void disconnectEndpoint();
+
/**
* Upgrades transport security of the active connection by using the TLS security protocol.
*
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
index e6879171f..e4ebbcecd 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
@@ -215,6 +215,14 @@ class InternalH2AsyncExecRuntime implements AsyncExecRuntime {
}
+ @Override
+ public void disconnectEndpoint() {
+ final Endpoint endpoint = sessionRef.get();
+ if (endpoint != null) {
+ endpoint.session.close(CloseMode.GRACEFUL);
+ }
+ }
+
@Override
public void upgradeTls(final HttpClientContext context) {
throw new UnsupportedOperationException();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
index a7f5d65b1..bf58c51be 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
@@ -235,6 +235,14 @@ class InternalHttpAsyncExecRuntime implements AsyncExecRuntime {
}
+ @Override
+ public void disconnectEndpoint() {
+ final AsyncConnectionEndpoint endpoint = endpointRef.get();
+ if (endpoint != null) {
+ endpoint.close(CloseMode.GRACEFUL);
+ }
+ }
+
@Override
public void upgradeTls(final HttpClientContext context) {
upgradeTls(context, null);