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 2017/01/28 13:39:51 UTC

svn commit: r1780688 - /httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/

Author: olegk
Date: Sat Jan 28 13:39:50 2017
New Revision: 1780688

URL: http://svn.apache.org/viewvc?rev=1780688&view=rev
Log:
HTTPASYNC-116: Correct cancellation of client message exchange

Added:
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java   (with props)
Modified:
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalClientExec.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalHttpAsyncClient.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalHttpAsyncClient.java
    httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java Sat Jan 28 13:39:50 2017
@@ -26,6 +26,13 @@
  */
 package org.apache.http.impl.nio.client;
 
+import java.io.IOException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
+
 import org.apache.commons.logging.Log;
 import org.apache.http.ConnectionClosedException;
 import org.apache.http.ConnectionReuseStrategy;
@@ -34,7 +41,6 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.HttpRequestWrapper;
 import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.conn.ConnectionKeepAliveStrategy;
 import org.apache.http.conn.routing.HttpRoute;
@@ -46,12 +52,6 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.Asserts;
 
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
 /**
  * Abstract {@link org.apache.http.nio.protocol.HttpAsyncClientExchangeHandler} class
  * that implements connection management aspects shared by all HTTP exchange handlers.
@@ -59,7 +59,7 @@ import java.util.concurrent.atomic.Atomi
  * Instances of this class are expected to be accessed by one thread at a time only.
  * The {@link #cancel()} method can be called concurrently by multiple threads.
  */
-abstract class AbstractClientExchangeHandler<T> implements HttpAsyncClientExchangeHandler {
+abstract class AbstractClientExchangeHandler implements HttpAsyncClientExchangeHandler {
 
     private static final AtomicLong COUNTER = new AtomicLong(1);
 
@@ -67,10 +67,10 @@ abstract class AbstractClientExchangeHan
 
     private final long id;
     private final HttpClientContext localContext;
-    private final BasicFuture<T> resultFuture;
     private final NHttpClientConnectionManager connmgr;
     private final ConnectionReuseStrategy connReuseStrategy;
     private final ConnectionKeepAliveStrategy keepaliveStrategy;
+    private final AtomicReference<Future<NHttpClientConnection>> connectionFutureRef;
     private final AtomicReference<NHttpClientConnection> managedConnRef;
     private final AtomicReference<HttpRoute> routeRef;
     private final AtomicReference<RouteTracker> routeTrackerRef;
@@ -84,7 +84,6 @@ abstract class AbstractClientExchangeHan
     AbstractClientExchangeHandler(
             final Log log,
             final HttpClientContext localContext,
-            final BasicFuture<T> resultFuture,
             final NHttpClientConnectionManager connmgr,
             final ConnectionReuseStrategy connReuseStrategy,
             final ConnectionKeepAliveStrategy keepaliveStrategy) {
@@ -92,10 +91,10 @@ abstract class AbstractClientExchangeHan
         this.log = log;
         this.id = COUNTER.getAndIncrement();
         this.localContext = localContext;
-        this.resultFuture = resultFuture;
         this.connmgr = connmgr;
         this.connReuseStrategy = connReuseStrategy;
         this.keepaliveStrategy = keepaliveStrategy;
+        this.connectionFutureRef = new AtomicReference<Future<NHttpClientConnection>>(null);
         this.managedConnRef = new AtomicReference<NHttpClientConnection>(null);
         this.routeRef = new AtomicReference<HttpRoute>(null);
         this.routeTrackerRef = new AtomicReference<RouteTracker>(null);
@@ -306,6 +305,7 @@ abstract class AbstractClientExchangeHan
             if (this.log.isDebugEnabled()) {
                 this.log.debug("[exchange: " + this.id + "] Connection allocated: " + managedConn);
             }
+            this.connectionFutureRef.set(null);
             this.managedConnRef.set(managedConn);
 
             if (this.closed.get()) {
@@ -332,6 +332,7 @@ abstract class AbstractClientExchangeHan
         if (this.log.isDebugEnabled()) {
             this.log.debug("[exchange: " + this.id + "] connection request failed");
         }
+        this.connectionFutureRef.set(null);
         failed(ex);
     }
 
@@ -339,8 +340,9 @@ abstract class AbstractClientExchangeHan
         if (this.log.isDebugEnabled()) {
             this.log.debug("[exchange: " + this.id + "] Connection request cancelled");
         }
+        this.connectionFutureRef.set(null);
         try {
-            this.resultFuture.cancel();
+            executionCancelled();
         } finally {
             close();
         }
@@ -360,7 +362,7 @@ abstract class AbstractClientExchangeHan
 
         final Object userToken = this.localContext.getUserToken();
         final RequestConfig config = this.localContext.getRequestConfig();
-        this.connmgr.requestConnection(
+        this.connectionFutureRef.set(this.connmgr.requestConnection(
                 route,
                 userToken,
                 config.getConnectTimeout(),
@@ -383,7 +385,7 @@ abstract class AbstractClientExchangeHan
                         connectionRequestCancelled();
                     }
 
-                });
+                }));
     }
 
     abstract void releaseResources();
@@ -409,14 +411,10 @@ abstract class AbstractClientExchangeHan
     public final void failed(final Exception ex) {
         if (this.closed.compareAndSet(false, true)) {
             try {
-                try {
-                    executionFailed(ex);
-                } finally {
-                    discardConnection();
-                    releaseResources();
-                }
+                executionFailed(ex);
             } finally {
-                this.resultFuture.failed(ex);
+                discardConnection();
+                releaseResources();
             }
         }
     }
@@ -428,14 +426,14 @@ abstract class AbstractClientExchangeHan
         }
         if (this.closed.compareAndSet(false, true)) {
             try {
-                try {
-                    return executionCancelled();
-                } finally {
-                    discardConnection();
-                    releaseResources();
+                final Future<NHttpClientConnection> connectionFuture = this.connectionFutureRef.getAndSet(null);
+                if (connectionFuture != null) {
+                    connectionFuture.cancel(true);
                 }
+                return executionCancelled();
             } finally {
-                this.resultFuture.cancel();
+                discardConnection();
+                releaseResources();
             }
         }
         return false;

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java Sat Jan 28 13:39:50 2017
@@ -70,7 +70,7 @@ class DefaultClientExchangeHandlerImpl<T
             final ConnectionReuseStrategy connReuseStrategy,
             final ConnectionKeepAliveStrategy keepaliveStrategy,
             final InternalClientExec exec) {
-        super(log, localContext, resultFuture, connmgr, connReuseStrategy, keepaliveStrategy);
+        super(log, localContext, connmgr, connReuseStrategy, keepaliveStrategy);
         this.requestProducer = requestProducer;
         this.responseConsumer = responseConsumer;
         this.resultFuture = resultFuture;
@@ -94,8 +94,12 @@ class DefaultClientExchangeHandlerImpl<T
 
     @Override
     void executionFailed(final Exception ex) {
-        this.requestProducer.failed(ex);
-        this.responseConsumer.failed(ex);
+        try {
+            this.requestProducer.failed(ex);
+            this.responseConsumer.failed(ex);
+        } finally {
+            this.resultFuture.failed(ex);
+        }
     }
 
     @Override

Added: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java?rev=1780688&view=auto
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java (added)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java Sat Jan 28 13:39:50 2017
@@ -0,0 +1,83 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.nio.client;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.http.concurrent.Cancellable;
+
+final class FutureWrapper<T> implements Future<T> {
+
+    private final Future<T> future;
+    private final Cancellable cancellable;
+
+    public FutureWrapper(final Future<T> future, final Cancellable cancellable) {
+        super();
+        this.future = future;
+        this.cancellable = cancellable;
+    }
+
+    @Override
+    public boolean cancel(final boolean mayInterruptIfRunning) {
+        try {
+            if (cancellable != null) {
+                cancellable.cancel();
+            }
+        } finally {
+            return future.cancel(mayInterruptIfRunning);
+        }
+    }
+
+    @Override
+    public boolean isCancelled() {
+        return future.isCancelled();
+    }
+
+    @Override
+    public boolean isDone() {
+        return future.isDone();
+    }
+
+    @Override
+    public T get() throws InterruptedException, ExecutionException {
+        return future.get();
+    }
+
+    @Override
+    public T get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
+        return future.get(timeout, unit);
+    }
+
+    @Override
+    public String toString() {
+        return future.toString();
+    }
+
+}

Propchange: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/FutureWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalClientExec.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalClientExec.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalClientExec.java Sat Jan 28 13:39:50 2017
@@ -42,11 +42,11 @@ interface InternalClientExec {
             HttpHost target,
             HttpRequest original,
             InternalState state,
-            AbstractClientExchangeHandler<?> handler) throws IOException, HttpException;
+            AbstractClientExchangeHandler handler) throws IOException, HttpException;
 
     HttpRequest generateRequest(
             InternalState state,
-            AbstractClientExchangeHandler<?> handler) throws IOException, HttpException;
+            AbstractClientExchangeHandler handler) throws IOException, HttpException;
 
     void produceContent(
             InternalState state,
@@ -55,12 +55,12 @@ interface InternalClientExec {
 
     void requestCompleted(
             InternalState state,
-            AbstractClientExchangeHandler<?> handler);
+            AbstractClientExchangeHandler handler);
 
     void responseReceived(
             HttpResponse response,
             InternalState state,
-            AbstractClientExchangeHandler<?> handler) throws IOException, HttpException;
+            AbstractClientExchangeHandler handler) throws IOException, HttpException;
 
     void consumeContent(
             InternalState state,
@@ -69,6 +69,6 @@ interface InternalClientExec {
 
     void responseCompleted(
             InternalState state,
-            AbstractClientExchangeHandler<?> handler) throws IOException, HttpException;
+            AbstractClientExchangeHandler handler) throws IOException, HttpException;
 
 }

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalHttpAsyncClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalHttpAsyncClient.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalHttpAsyncClient.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/InternalHttpAsyncClient.java Sat Jan 28 13:39:50 2017
@@ -142,7 +142,7 @@ class InternalHttpAsyncClient extends Cl
         } catch (final Exception ex) {
             handler.failed(ex);
         }
-        return future;
+        return new FutureWrapper<T>(future, handler);
     }
 
     @Override

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MainClientExec.java Sat Jan 28 13:39:50 2017
@@ -116,7 +116,7 @@ class MainClientExec implements Internal
             final HttpHost target,
             final HttpRequest original,
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws HttpException, IOException {
+            final AbstractClientExchangeHandler handler) throws HttpException, IOException {
         if (this.log.isDebugEnabled()) {
             this.log.debug("[exchange: " + state.getId() + "] start execution");
         }
@@ -149,7 +149,7 @@ class MainClientExec implements Internal
     @Override
     public HttpRequest generateRequest(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws IOException, HttpException {
+            final AbstractClientExchangeHandler handler) throws IOException, HttpException {
 
         final HttpRoute route = handler.getRoute();
 
@@ -268,7 +268,7 @@ class MainClientExec implements Internal
     @Override
     public void requestCompleted(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) {
+            final AbstractClientExchangeHandler handler) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("[exchange: " + state.getId() + "] Request completed");
         }
@@ -281,7 +281,7 @@ class MainClientExec implements Internal
     public void responseReceived(
             final HttpResponse response,
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws IOException, HttpException {
+            final AbstractClientExchangeHandler handler) throws IOException, HttpException {
         if (this.log.isDebugEnabled()) {
             this.log.debug("[exchange: " + state.getId() + "] Response received " + response.getStatusLine());
         }
@@ -337,7 +337,7 @@ class MainClientExec implements Internal
     @Override
     public void responseCompleted(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws IOException, HttpException {
+            final AbstractClientExchangeHandler handler) throws IOException, HttpException {
         final HttpClientContext localContext = state.getLocalContext();
         final HttpResponse currentResponse = handler.getCurrentResponse();
 
@@ -469,7 +469,7 @@ class MainClientExec implements Internal
 
     private void prepareRequest(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws IOException, HttpException {
+            final AbstractClientExchangeHandler handler) throws IOException, HttpException {
         final HttpClientContext localContext = state.getLocalContext();
         final HttpRequestWrapper currentRequest = handler.getCurrentRequest();
         final HttpRoute route = handler.getRoute();
@@ -540,7 +540,7 @@ class MainClientExec implements Internal
 
     private boolean handleConnectResponse(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws HttpException {
+            final AbstractClientExchangeHandler handler) throws HttpException {
         final HttpClientContext localContext = state.getLocalContext();
         final RequestConfig config = localContext.getRequestConfig();
         if (config.isAuthenticationEnabled()) {
@@ -562,7 +562,7 @@ class MainClientExec implements Internal
 
     private boolean handleResponse(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws HttpException {
+            final AbstractClientExchangeHandler handler) throws HttpException {
         final HttpClientContext localContext = state.getLocalContext();
         final RequestConfig config = localContext.getRequestConfig();
         if (config.isAuthenticationEnabled()) {
@@ -599,7 +599,7 @@ class MainClientExec implements Internal
 
     private boolean needAuthentication(
             final InternalState state,
-            final AbstractClientExchangeHandler<?> handler) throws HttpException {
+            final AbstractClientExchangeHandler handler) throws HttpException {
         final HttpClientContext localContext = state.getLocalContext();
         final CredentialsProvider credsProvider = localContext.getCredentialsProvider();
         if (credsProvider != null) {

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java Sat Jan 28 13:39:50 2017
@@ -76,7 +76,7 @@ class MinimalClientExchangeHandlerImpl<T
             final HttpProcessor httpProcessor,
             final ConnectionReuseStrategy connReuseStrategy,
             final ConnectionKeepAliveStrategy keepaliveStrategy) {
-        super(log, localContext, resultFuture, connmgr, connReuseStrategy, keepaliveStrategy);
+        super(log, localContext, connmgr, connReuseStrategy, keepaliveStrategy);
         this.requestProducer = requestProducer;
         this.responseConsumer = responseConsumer;
         this.localContext = localContext;

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalHttpAsyncClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalHttpAsyncClient.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalHttpAsyncClient.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalHttpAsyncClient.java Sat Jan 28 13:39:50 2017
@@ -111,7 +111,7 @@ class MinimalHttpAsyncClient extends Clo
         } catch (final Exception ex) {
             handler.failed(ex);
         }
-        return future;
+        return new FutureWrapper<T>(future, handler);
     }
 
     @Override
@@ -142,7 +142,7 @@ class MinimalHttpAsyncClient extends Clo
         } catch (final Exception ex) {
             handler.failed(ex);
         }
-        return future;
+        return new FutureWrapper<List<T>>(future, handler);
     }
 
 }

Modified: httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java?rev=1780688&r1=1780687&r2=1780688&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java (original)
+++ httpcomponents/httpasyncclient/branches/4.1.x/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java Sat Jan 28 13:39:50 2017
@@ -91,7 +91,7 @@ class PipeliningClientExchangeHandlerImp
             final HttpProcessor httpProcessor,
             final ConnectionReuseStrategy connReuseStrategy,
             final ConnectionKeepAliveStrategy keepaliveStrategy) {
-        super(log, localContext, resultFuture, connmgr, connReuseStrategy, keepaliveStrategy);
+        super(log, localContext, connmgr, connReuseStrategy, keepaliveStrategy);
         Args.notNull(target, "HTTP target");
         Args.notEmpty(requestProducers, "Request producer list");
         Args.notEmpty(responseConsumers, "Response consumer list");