Return-Path: X-Original-To: apmail-hc-commits-archive@www.apache.org Delivered-To: apmail-hc-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2A2E083DD for ; Wed, 10 Aug 2011 13:51:13 +0000 (UTC) Received: (qmail 59840 invoked by uid 500); 10 Aug 2011 13:51:13 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 59794 invoked by uid 500); 10 Aug 2011 13:51:12 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 59787 invoked by uid 99); 10 Aug 2011 13:51:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2011 13:51:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2011 13:51:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D42D323889F7 for ; Wed, 10 Aug 2011 13:50:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1156184 - /httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java Date: Wed, 10 Aug 2011 13:50:49 -0000 To: commits@hc.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110810135049.D42D323889F7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: olegk Date: Wed Aug 10 13:50:49 2011 New Revision: 1156184 URL: http://svn.apache.org/viewvc?rev=1156184&view=rev Log: Make sure the state of the response consumer gets carried over to its respective future even if the HTTP exchange has been cancelled prematurely Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java?rev=1156184&r1=1156183&r2=1156184&view=diff ============================================================================== --- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java (original) +++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java Wed Aug 10 13:50:49 2011 @@ -422,7 +422,16 @@ class DefaultAsyncRequestDirector imp this.log.debug("HTTP exchange cancelled"); try { this.responseConsumer.cancel(); - this.resultCallback.cancelled(this); + + T result = this.responseConsumer.getResult(); + Exception ex = this.responseConsumer.getException(); + if (ex != null) { + this.resultCallback.failed(ex, this); + } else if (result != null) { + this.resultCallback.completed(result, this); + } else { + this.resultCallback.cancelled(this); + } } catch (RuntimeException runex) { this.resultCallback.failed(runex, this); throw runex;