Upgraded HttpCore to version 4.4.4
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/branches/4.1.x@1711493 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java b/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
index 8eaa3cc..9e5255b 100644
--- a/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
+++ b/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/AbstractClientExchangeHandler.java
@@ -26,12 +26,6 @@
*/
package org.apache.http.impl.nio.client;
-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;
-
import org.apache.commons.logging.Log;
import org.apache.http.ConnectionClosedException;
import org.apache.http.ConnectionReuseStrategy;
@@ -49,8 +43,15 @@
import org.apache.http.nio.conn.NHttpClientConnectionManager;
import org.apache.http.nio.protocol.HttpAsyncClientExchangeHandler;
import org.apache.http.nio.protocol.HttpAsyncRequestExecutor;
+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.
@@ -312,10 +313,14 @@
return;
}
- managedConn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this);
- managedConn.requestOutput();
- if (managedConn.isStale()) {
- failed(new ConnectionClosedException("Connection closed"));
+ final HttpContext context = managedConn.getContext();
+ synchronized (context) {
+ context.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this);
+ if (managedConn.isStale()) {
+ failed(new ConnectionClosedException("Connection closed"));
+ } else {
+ managedConn.requestOutput();
+ }
}
} catch (final RuntimeException runex) {
failed(runex);
diff --git a/pom.xml b/pom.xml
index 9d26c0d..be5856a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,7 +66,7 @@
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
- <httpcore.version>4.4.3</httpcore.version>
+ <httpcore.version>4.4.4</httpcore.version>
<httpclient.version>4.5.1</httpclient.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-io.version>2.4</commons-io.version>