Bug fix: PipeliningClientExchangeHandlerImpl to fail result future in case of an execution failure
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/branches/4.1.x@1865743 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java b/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java
index c5e8a9e..435f4d1 100644
--- a/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java
+++ b/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/PipeliningClientExchangeHandlerImpl.java
@@ -145,16 +145,20 @@
@Override
void executionFailed(final Exception ex) {
- final HttpAsyncRequestProducer requestProducer = this.requestProducerRef.get();
- if (requestProducer != null) {
- requestProducer.failed(ex);
- }
- final HttpAsyncResponseConsumer<T> responseConsumer = this.responseConsumerRef.get();
- if (responseConsumer != null) {
- responseConsumer.failed(ex);
- }
- for (final HttpAsyncResponseConsumer<T> cancellable: this.responseConsumerQueue) {
- cancellable.cancel();
+ try {
+ final HttpAsyncRequestProducer requestProducer = this.requestProducerRef.get();
+ if (requestProducer != null) {
+ requestProducer.failed(ex);
+ }
+ final HttpAsyncResponseConsumer<T> responseConsumer = this.responseConsumerRef.get();
+ if (responseConsumer != null) {
+ responseConsumer.failed(ex);
+ }
+ for (final HttpAsyncResponseConsumer<T> cancellable: this.responseConsumerQueue) {
+ cancellable.cancel();
+ }
+ } finally {
+ this.resultFuture.failed(ex);
}
}