[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    [httpcomponents-client] branch 5.0.x updated: Extra sage-guards for concurrent connection endpoint a
From:       olegk () apache ! org
Date:       2021-04-28 14:38:05
Message-ID: 161962068517.21432.10034616794492477458 () gitbox ! apache ! org
[Download RAW message or body]

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

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


The following commit(s) were added to refs/heads/5.0.x by this push:
     new 2ee6454  Extra sage-guards for concurrent connection endpoint acquisition \
and request execution cancellation 2ee6454 is described below

commit 2ee645451aea8a42e49fe602ddfcfecbb80b57ce
Author: Oleg Kalnichevski <olegk@apache.org>
AuthorDate: Wed Apr 28 16:31:16 2021 +0200

    Extra sage-guards for concurrent connection endpoint acquisition and request \
                execution cancellation
---
 .../apache/hc/client5/http/impl/classic/InternalExecRuntime.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java \
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
 index abd8afe..299f56d 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
                
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
 @@ -103,11 +103,11 @@ class InternalExecRuntime implements ExecRuntime, Cancellable \
                {
             final LeaseRequest connRequest = manager.lease(id, route, \
connectionRequestTimeout, object);  state = object;
             if (cancellableDependency != null) {
+                cancellableDependency.setDependency(connRequest);
                 if (cancellableDependency.isCancelled()) {
                     connRequest.cancel();
                     throw new RequestFailedException("Request aborted");
                 }
-                cancellableDependency.setDependency(connRequest);
             }
             try {
                 final ConnectionEndpoint connectionEndpoint = \
connRequest.get(connectionRequestTimeout); @@ -115,6 +115,10 @@ class \
InternalExecRuntime implements ExecRuntime, Cancellable {  reusable = \
connectionEndpoint.isConnected();  if (cancellableDependency != null) {
                     cancellableDependency.setDependency(this);
+                    if (cancellableDependency.isCancelled()) {
+                        cancel();
+                        throw new RequestFailedException("Request aborted");
+                    }
                 }
                 if (log.isDebugEnabled()) {
                     log.debug("{}: acquired endpoint {}", id, \
ConnPoolSupport.getId(connectionEndpoint));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic