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 2018/08/30 08:57:55 UTC
[1/2] httpcomponents-client git commit: Upgraded HttpCore dependency
to version 5.0-beta3
Repository: httpcomponents-client
Updated Branches:
refs/heads/master 3aa9c1fd3 -> 1614c2516
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
index b605da4..66356ee 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
@@ -41,6 +41,7 @@ import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.Identifiable;
import org.slf4j.Logger;
@@ -67,21 +68,22 @@ final class LoggingAsyncClientExchangeHandler implements AsyncClientExchangeHand
}
@Override
- public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
+ public void produceRequest(final RequestChannel channel, final HttpContext context) throws HttpException, IOException {
handler.produceRequest(new RequestChannel() {
@Override
public void sendRequest(
final HttpRequest request,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
if (log.isDebugEnabled()) {
log.debug(exchangeId + ": send request " + new RequestLine(request) + ", " +
(entityDetails != null ? "entity len " + entityDetails.getContentLength() : "null entity"));
}
- channel.sendRequest(request, entityDetails);
+ channel.sendRequest(request, entityDetails, context);
}
- });
+ }, context);
}
@Override
@@ -129,22 +131,25 @@ final class LoggingAsyncClientExchangeHandler implements AsyncClientExchangeHand
}
@Override
- public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+ public void consumeInformation(
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
if (log.isDebugEnabled()) {
log.debug(exchangeId + ": information response " + new StatusLine(response));
}
- handler.consumeInformation(response);
+ handler.consumeInformation(response, context);
}
@Override
public void consumeResponse(
final HttpResponse response,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
if (log.isDebugEnabled()) {
log.debug(exchangeId + ": consume response " + new StatusLine(response) + ", " +
(entityDetails != null ? "entity len " + entityDetails.getContentLength() : " null entity"));
}
- handler.consumeResponse(response, entityDetails);
+ handler.consumeResponse(response, entityDetails, context);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
index e8a8166..5004696 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
@@ -32,29 +32,31 @@ import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel;
import java.nio.channels.SelectionKey;
+import java.util.concurrent.locks.Lock;
import javax.net.ssl.SSLContext;
import org.apache.hc.client5.http.impl.Wire;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
+import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.IOEventHandler;
-import org.apache.hc.core5.reactor.TlsCapableIOSession;
-import org.apache.hc.core5.reactor.ssl.SSLBufferManagement;
+import org.apache.hc.core5.reactor.ProtocolIOSession;
+import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
import org.apache.hc.core5.reactor.ssl.SSLSessionInitializer;
import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
import org.slf4j.Logger;
-class LoggingIOSession implements TlsCapableIOSession {
+class LoggingIOSession implements ProtocolIOSession {
private final Logger log;
private final Wire wireLog;
private final String id;
- private final TlsCapableIOSession session;
+ private final ProtocolIOSession session;
private final ByteChannel channel;
- public LoggingIOSession(final TlsCapableIOSession session, final String id, final Logger log, final Logger wireLog) {
+ public LoggingIOSession(final ProtocolIOSession session, final String id, final Logger log, final Logger wireLog) {
super();
this.session = session;
this.id = id;
@@ -63,7 +65,7 @@ class LoggingIOSession implements TlsCapableIOSession {
this.channel = new LoggingByteChannel();
}
- public LoggingIOSession(final TlsCapableIOSession session, final String id, final Logger log) {
+ public LoggingIOSession(final ProtocolIOSession session, final String id, final Logger log) {
this(session, id, log, null);
}
@@ -73,18 +75,23 @@ class LoggingIOSession implements TlsCapableIOSession {
}
@Override
- public void addLast(final Command command) {
- this.session.addLast(command);
+ public Lock lock() {
+ return this.session.lock();
}
@Override
- public void addFirst(final Command command) {
- this.session.addFirst(command);
+ public boolean hasCommands() {
+ return this.session.hasCommands();
}
@Override
- public Command getCommand() {
- return this.session.getCommand();
+ public Command poll() {
+ return this.session.poll();
+ }
+
+ @Override
+ public void enqueue(final Command command, final Command.Priority priority) {
+ this.session.enqueue(command, priority);
}
@Override
@@ -169,29 +176,29 @@ class LoggingIOSession implements TlsCapableIOSession {
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
if (this.log.isDebugEnabled()) {
- this.log.debug(this.id + " " + this.session + ": Shutdown " + shutdownType);
+ this.log.debug(this.id + " " + this.session + ": Close " + closeMode);
}
- this.session.shutdown(shutdownType);
+ this.session.close(closeMode);
}
@Override
- public int getSocketTimeout() {
- return this.session.getSocketTimeout();
+ public int getSocketTimeoutMillis() {
+ return this.session.getSocketTimeoutMillis();
}
@Override
- public void setSocketTimeout(final int timeout) {
+ public void setSocketTimeoutMillis(final int timeout) {
if (this.log.isDebugEnabled()) {
this.log.debug(this.id + " " + this.session + ": Set timeout " + timeout);
}
- this.session.setSocketTimeout(timeout);
+ this.session.setSocketTimeoutMillis(timeout);
}
@Override
- public long getLastReadTime() {
- return this.session.getLastReadTime();
+ public long getLastReadTimeMillis() {
+ return this.session.getLastReadTimeMillis();
}
@Override
@@ -215,17 +222,18 @@ class LoggingIOSession implements TlsCapableIOSession {
}
@Override
- public void setHandler(final IOEventHandler handler) {
- this.session.setHandler(handler);
+ public void upgrade(final IOEventHandler handler) {
+ this.session.upgrade(handler);
}
@Override
public void startTls(
final SSLContext sslContext,
- final SSLBufferManagement sslBufferManagement,
+ final NamedEndpoint endpoint,
+ final SSLBufferMode sslBufferMode,
final SSLSessionInitializer initializer,
final SSLSessionVerifier verifier) throws UnsupportedOperationException {
- session.startTls(sslContext, sslBufferManagement, initializer, verifier);
+ session.startTls(sslContext, endpoint, sslBufferMode, initializer, verifier);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
index 453ee0a..570ff7a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
@@ -56,12 +56,13 @@ import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
-import org.apache.hc.core5.http.nio.command.ExecutionCommand;
+import org.apache.hc.core5.http.nio.command.RequestExecutionCommand;
import org.apache.hc.core5.http.nio.command.ShutdownCommand;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.nio.pool.H2ConnPool;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
+import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.ConnectionInitiator;
import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
@@ -92,7 +93,7 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
@Override
public void execute(final IOSession ioSession) {
- ioSession.addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+ ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE);
}
}),
@@ -122,7 +123,8 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
@Override
public void sendRequest(
final HttpRequest request,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
RequestConfig requestConfig = null;
if (request instanceof Configurable) {
requestConfig = ((Configurable) request).getConfig();
@@ -158,8 +160,9 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
@Override
public void produceRequest(
- final RequestChannel channel) throws HttpException, IOException {
- channel.sendRequest(request, entityDetails);
+ final RequestChannel channel,
+ final HttpContext context) throws HttpException, IOException {
+ channel.sendRequest(request, entityDetails, context);
}
@Override
@@ -174,14 +177,17 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
@Override
public void consumeInformation(
- final HttpResponse response) throws HttpException, IOException {
- exchangeHandler.consumeInformation(response);
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
+ exchangeHandler.consumeInformation(response, context);
}
@Override
public void consumeResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
- exchangeHandler.consumeResponse(response, entityDetails);
+ final HttpResponse response,
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
+ exchangeHandler.consumeResponse(response, entityDetails, context);
}
@Override
@@ -203,11 +209,15 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
if (log.isDebugEnabled()) {
final String exchangeId = ExecSupport.getNextExchangeId();
log.debug(ConnPoolSupport.getId(session) + ": executing message exchange " + exchangeId);
- session.addLast(new ExecutionCommand(
- new LoggingAsyncClientExchangeHandler(log, exchangeId, internalExchangeHandler),
- cancellable, clientContext));
+ session.enqueue(
+ new RequestExecutionCommand(
+ new LoggingAsyncClientExchangeHandler(log, exchangeId, internalExchangeHandler),
+ null, cancellable, clientContext),
+ Command.Priority.NORMAL);
} else {
- session.addLast(new ExecutionCommand(internalExchangeHandler, cancellable, clientContext));
+ session.enqueue(
+ new RequestExecutionCommand(internalExchangeHandler, null, cancellable, clientContext),
+ Command.Priority.NORMAL);
}
}
@@ -232,7 +242,7 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
});
}
- });
+ }, context);
} catch (final HttpException | IOException ex) {
exchangeHandler.failed(ex);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
index 2f57053..c07c4d2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
@@ -62,13 +62,16 @@ import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
+import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
+import org.apache.hc.core5.http.nio.HandlerFactory;
import org.apache.hc.core5.http.nio.RequestChannel;
import org.apache.hc.core5.http.nio.command.ShutdownCommand;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.HttpVersionPolicy;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
+import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.IOReactorConfig;
@@ -103,7 +106,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
@Override
public void execute(final IOSession ioSession) {
- ioSession.addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+ ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.NORMAL);
}
}),
@@ -223,7 +226,8 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
@Override
public void sendRequest(
final HttpRequest request,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
RequestConfig requestConfig = null;
if (request instanceof Configurable) {
requestConfig = ((Configurable) request).getConfig();
@@ -270,8 +274,9 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
@Override
public void produceRequest(
- final RequestChannel channel) throws HttpException, IOException {
- channel.sendRequest(request, entityDetails);
+ final RequestChannel channel,
+ final HttpContext context) throws HttpException, IOException {
+ channel.sendRequest(request, entityDetails, context);
if (entityDetails == null) {
messageCountDown.decrementAndGet();
}
@@ -317,14 +322,17 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
@Override
public void consumeInformation(
- final HttpResponse response) throws HttpException, IOException {
- exchangeHandler.consumeInformation(response);
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
+ exchangeHandler.consumeInformation(response, context);
}
@Override
public void consumeResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
- exchangeHandler.consumeResponse(response, entityDetails);
+ final HttpResponse response,
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
+ exchangeHandler.consumeResponse(response, entityDetails, context);
if (response.getCode() >= HttpStatus.SC_CLIENT_ERROR) {
messageCountDown.decrementAndGet();
}
@@ -378,7 +386,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
});
}
- });
+ }, context);
} catch (final HttpException | IOException ex) {
exchangeHandler.failed(ex);
@@ -401,7 +409,10 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
}
@Override
- public void execute(final AsyncClientExchangeHandler exchangeHandler, final HttpContext context) {
+ public void execute(
+ final AsyncClientExchangeHandler exchangeHandler,
+ final HandlerFactory<AsyncPushConsumer> pushHandlerFactory,
+ final HttpContext context) {
Asserts.check(!released.get(), "Endpoint has already been released");
if (log.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
index a132d9c..ab1801e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
@@ -164,13 +164,13 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
}
@Override
- public void removeHeader(final Header header) {
- response.removeHeader(header);
+ public boolean removeHeader(final Header header) {
+ return response.removeHeader(header);
}
@Override
- public void removeHeaders(final String name) {
- response.removeHeaders(name);
+ public boolean removeHeaders(final String name) {
+ return response.removeHeaders(name);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
----------------------------------------------------------------------
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 d93e80b..e0913b0 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
@@ -46,7 +46,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ConnectionRequestTimeoutException;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
@@ -239,7 +239,7 @@ class InternalExecRuntime implements ExecRuntime, Cancellable {
final ConnectionEndpoint endpoint = endpointRef.getAndSet(null);
if (endpoint != null) {
try {
- endpoint.shutdown(ShutdownType.IMMEDIATE);
+ endpoint.close(CloseMode.IMMEDIATE);
log.debug("Connection discarded");
} finally {
manager.release(endpoint, null, TimeValue.ZERO_MILLISECONDS);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java
index adab87d..33eb6b2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MainClientExec.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http.ConnectionReuseStrategy;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.message.RequestLine;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
import org.slf4j.Logger;
@@ -149,7 +149,7 @@ final class MainClientExec implements ExecChainHandler {
execRuntime.discardConnection();
throw ex;
} catch (final Error error) {
- connectionManager.shutdown(ShutdownType.IMMEDIATE);
+ connectionManager.close(CloseMode.IMMEDIATE);
throw error;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
index d8da21a..dfcaee6 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
@@ -61,7 +61,7 @@ import org.apache.hc.core5.http.protocol.HttpProcessor;
import org.apache.hc.core5.http.protocol.RequestContent;
import org.apache.hc.core5.http.protocol.RequestTargetHost;
import org.apache.hc.core5.http.protocol.RequestUserAgent;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.net.URIAuthority;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.VersionInfo;
@@ -166,7 +166,7 @@ public class MinimalHttpClient extends CloseableHttpClient {
execRuntime.discardConnection();
throw ex;
} catch (final Error error) {
- connManager.shutdown(ShutdownType.IMMEDIATE);
+ connManager.close(CloseMode.IMMEDIATE);
throw error;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
index 478c47a..20b0578 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
@@ -56,11 +56,11 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.config.Registry;
import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.Asserts;
import org.apache.hc.core5.util.LangUtils;
@@ -152,13 +152,13 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
@Override
public void close() {
- shutdown(ShutdownType.GRACEFUL);
+ close(CloseMode.GRACEFUL);
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) {
- closeConnection(shutdownType);
+ closeConnection(closeMode);
}
}
@@ -205,10 +205,10 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
};
}
- private synchronized void closeConnection(final ShutdownType shutdownType) {
+ private synchronized void closeConnection(final CloseMode closeMode) {
if (this.conn != null) {
- this.log.debug("Shutting down connection " + shutdownType);
- this.conn.shutdown(shutdownType);
+ this.log.debug("Closing connection " + closeMode);
+ this.conn.close(closeMode);
this.conn = null;
}
}
@@ -218,7 +218,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
if (this.log.isDebugEnabled()) {
this.log.debug("Connection expired @ " + new Date(this.expiry));
}
- closeConnection(ShutdownType.GRACEFUL);
+ closeConnection(CloseMode.GRACEFUL);
}
}
@@ -229,7 +229,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
}
Asserts.check(!this.leased, "Connection is still allocated");
if (!LangUtils.equals(this.route, route) || !LangUtils.equals(this.state, state)) {
- closeConnection(ShutdownType.GRACEFUL);
+ closeConnection(CloseMode.GRACEFUL);
}
this.route = route;
this.state = state;
@@ -263,7 +263,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
}
try {
if (keepAlive == null) {
- this.conn.shutdown(ShutdownType.GRACEFUL);
+ this.conn.close(CloseMode.GRACEFUL);
}
this.updated = System.currentTimeMillis();
if (!this.conn.isOpen()) {
@@ -352,7 +352,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
}
final long deadline = System.currentTimeMillis() - time;
if (this.updated <= deadline) {
- closeConnection(ShutdownType.GRACEFUL);
+ closeConnection(CloseMode.GRACEFUL);
}
}
}
@@ -396,10 +396,10 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
final ManagedHttpClientConnection conn = detach();
if (conn != null) {
- conn.shutdown(shutdownType);
+ conn.close(closeMode);
}
}
@@ -413,7 +413,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
@Override
public void setSocketTimeout(final int timeout) {
- getValidatedConnection().setSocketTimeout(timeout);
+ getValidatedConnection().setSocketTimeoutMillis(timeout);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
index 0d7f9b8..bf915fd 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
@@ -52,7 +52,7 @@ import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.ConnectionClosedException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.Lookup;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
index ef2cd90..0b7d1f5 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
@@ -49,7 +49,7 @@ import org.apache.hc.core5.http.io.HttpMessageParserFactory;
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
import org.apache.hc.core5.http.message.RequestLine;
import org.apache.hc.core5.http.message.StatusLine;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.util.Identifiable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -133,20 +133,20 @@ final class DefaultManagedHttpClientConnection
}
@Override
- public void setSocketTimeout(final int timeout) {
+ public void setSocketTimeoutMillis(final int timeout) {
if (this.log.isDebugEnabled()) {
this.log.debug(this.id + ": set socket timeout to " + timeout);
}
- super.setSocketTimeout(timeout);
+ super.setSocketTimeoutMillis(timeout);
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) {
- this.log.debug(this.id + ": Shutdown connection " + shutdownType);
+ this.log.debug(this.id + ": close connection " + closeMode);
}
- super.shutdown(shutdownType);
+ super.close(closeMode);
}
}
@@ -180,12 +180,12 @@ final class DefaultManagedHttpClientConnection
@Override
public void passivate() {
- super.setSocketTimeout(0);
+ super.setSocketTimeoutMillis(0);
}
@Override
public void activate() {
- super.setSocketTimeout(socketTimeout);
+ super.setSocketTimeoutMillis(socketTimeout);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
index ecd7cbb..d9562a9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
@@ -57,11 +57,11 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.Registry;
import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.pool.ConnPoolControl;
import org.apache.hc.core5.pool.LaxConnPool;
import org.apache.hc.core5.pool.ManagedConnPool;
@@ -222,16 +222,16 @@ public class PoolingHttpClientConnectionManager
@Override
public void close() {
- shutdown(ShutdownType.GRACEFUL);
+ close(CloseMode.GRACEFUL);
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) {
- this.log.debug("Shutdown connection pool " + shutdownType);
+ this.log.debug("Shutdown connection pool " + closeMode);
}
- this.pool.shutdown(shutdownType);
+ this.pool.close(closeMode);
this.log.debug("Connection pool shut down");
}
}
@@ -293,7 +293,7 @@ public class PoolingHttpClientConnectionManager
if (log.isDebugEnabled()) {
log.debug("Connection " + ConnPoolSupport.getId(conn) + " is stale");
}
- poolEntry.discardConnection(ShutdownType.IMMEDIATE);
+ poolEntry.discardConnection(CloseMode.IMMEDIATE);
}
}
}
@@ -337,7 +337,7 @@ public class PoolingHttpClientConnectionManager
}
final ManagedHttpClientConnection conn = entry.getConnection();
if (conn != null && keepAlive == null) {
- conn.shutdown(ShutdownType.GRACEFUL);
+ conn.close(CloseMode.GRACEFUL);
}
boolean reusable = conn != null && conn.isOpen();
try {
@@ -523,10 +523,10 @@ public class PoolingHttpClientConnectionManager
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
final PoolEntry<HttpRoute, ManagedHttpClientConnection> poolEntry = poolEntryRef.get();
if (poolEntry != null) {
- poolEntry.discardConnection(shutdownType);
+ poolEntry.discardConnection(closeMode);
}
}
@@ -534,7 +534,7 @@ public class PoolingHttpClientConnectionManager
public void close() throws IOException {
final PoolEntry<HttpRoute, ManagedHttpClientConnection> poolEntry = poolEntryRef.get();
if (poolEntry != null) {
- poolEntry.discardConnection(ShutdownType.GRACEFUL);
+ poolEntry.discardConnection(CloseMode.GRACEFUL);
}
}
@@ -547,7 +547,7 @@ public class PoolingHttpClientConnectionManager
@Override
public void setSocketTimeout(final int timeout) {
- getValidatedPoolEntry().getConnection().setSocketTimeout(timeout);
+ getValidatedPoolEntry().getConnection().setSocketTimeoutMillis(timeout);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
index 037c733..79f945c 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
@@ -35,8 +35,8 @@ import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.pool.PoolConcurrencyPolicy;
import org.apache.hc.core5.pool.PoolReusePolicy;
import org.apache.hc.core5.util.TimeValue;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
index 29ff01e..7022d27 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
@@ -42,11 +42,13 @@ import org.apache.hc.core5.http.HttpConnection;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.ProtocolVersion;
import org.apache.hc.core5.http.nio.command.ShutdownCommand;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
+import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.IOEventHandler;
import org.apache.hc.core5.reactor.IOSession;
-import org.apache.hc.core5.reactor.ssl.SSLBufferManagement;
+import org.apache.hc.core5.reactor.ProtocolLayer;
+import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
import org.apache.hc.core5.reactor.ssl.SSLSessionInitializer;
import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
@@ -71,7 +73,7 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
public DefaultManagedAsyncClientConnection(final IOSession ioSession) {
this.ioSession = ioSession;
- this.socketTimeout = ioSession.getSocketTimeout();
+ this.socketTimeout = ioSession.getSocketTimeoutMillis();
this.closed = new AtomicBoolean();
}
@@ -81,12 +83,12 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) {
if (log.isDebugEnabled()) {
- log.debug(getId() + ": Shutdown connection " + shutdownType);
+ log.debug(getId() + ": Shutdown connection " + closeMode);
}
- ioSession.shutdown(shutdownType);
+ ioSession.close(closeMode);
}
}
@@ -96,7 +98,7 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
if (log.isDebugEnabled()) {
log.debug(getId() + ": Close connection");
}
- ioSession.addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+ ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE);
}
}
@@ -106,13 +108,13 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
}
@Override
- public void setSocketTimeout(final int timeout) {
- ioSession.setSocketTimeout(timeout);
+ public void setSocketTimeoutMillis(final int timeout) {
+ ioSession.setSocketTimeoutMillis(timeout);
}
@Override
- public int getSocketTimeout() {
- return ioSession.getSocketTimeout();
+ public int getSocketTimeoutMillis() {
+ return ioSession.getSocketTimeoutMillis();
}
@Override
@@ -127,35 +129,38 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
@Override
public EndpointDetails getEndpointDetails() {
- final IOEventHandler handler = ioSession.getHandler();
- if (handler instanceof HttpConnection) {
- return ((HttpConnection) handler).getEndpointDetails();
- } else {
- return null;
+ if (ioSession instanceof ProtocolLayer) {
+ final IOEventHandler handler = ((ProtocolLayer) ioSession).getHandler();
+ if (handler instanceof HttpConnection) {
+ return ((HttpConnection) handler).getEndpointDetails();
+ }
}
+ return null;
}
@Override
public ProtocolVersion getProtocolVersion() {
- final IOEventHandler handler = ioSession.getHandler();
- if (handler instanceof HttpConnection) {
- return ((HttpConnection) handler).getProtocolVersion();
- } else {
- return HttpVersion.DEFAULT;
+ if (ioSession instanceof ProtocolLayer) {
+ final IOEventHandler handler = ((ProtocolLayer) ioSession).getHandler();
+ if (handler instanceof HttpConnection) {
+ return ((HttpConnection) handler).getProtocolVersion();
+ }
}
+ return HttpVersion.DEFAULT;
}
@Override
public void startTls(
final SSLContext sslContext,
- final SSLBufferManagement sslBufferManagement,
+ final NamedEndpoint endpoint,
+ final SSLBufferMode sslBufferMode,
final SSLSessionInitializer initializer,
final SSLSessionVerifier verifier) throws UnsupportedOperationException {
if (log.isDebugEnabled()) {
log.debug(getId() + ": start TLS");
}
if (ioSession instanceof TransportSecurityLayer) {
- ((TransportSecurityLayer) ioSession).startTls(sslContext, sslBufferManagement, initializer, verifier);
+ ((TransportSecurityLayer) ioSession).startTls(sslContext, endpoint, sslBufferMode, initializer, verifier);
} else {
throw new UnsupportedOperationException("TLS upgrade not supported");
}
@@ -177,7 +182,7 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
if (log.isDebugEnabled()) {
log.debug(getId() + ": priority command " + command);
}
- ioSession.addFirst(command);
+ ioSession.enqueue(command, Command.Priority.IMMEDIATE);
}
@Override
@@ -185,17 +190,17 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
if (log.isDebugEnabled()) {
log.debug(getId() + ": command " + command);
}
- ioSession.addLast(command);
+ ioSession.enqueue(command, Command.Priority.NORMAL);
}
@Override
public void passivate() {
- ioSession.setSocketTimeout(0);
+ ioSession.setSocketTimeoutMillis(0);
}
@Override
public void activate() {
- ioSession.setSocketTimeout(socketTimeout);
+ ioSession.setSocketTimeoutMillis(socketTimeout);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
index 00d1d7b..1167592 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
@@ -57,12 +57,12 @@ import org.apache.hc.core5.http.ProtocolVersion;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.config.RegistryBuilder;
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
-import org.apache.hc.core5.http.nio.command.ExecutionCommand;
+import org.apache.hc.core5.http.nio.command.RequestExecutionCommand;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.nio.command.PingCommand;
import org.apache.hc.core5.http2.nio.support.BasicPingHandler;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.pool.ConnPoolControl;
import org.apache.hc.core5.pool.LaxConnPool;
import org.apache.hc.core5.pool.ManagedConnPool;
@@ -188,16 +188,16 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
@Override
public void close() {
- shutdown(ShutdownType.GRACEFUL);
+ close(CloseMode.GRACEFUL);
}
@Override
- public void shutdown(final ShutdownType shutdownType) {
+ public void close(final CloseMode closeMode) {
if (this.closed.compareAndSet(false, true)) {
if (this.log.isDebugEnabled()) {
- this.log.debug("Shutdown connection pool " + shutdownType);
+ this.log.debug("Shutdown connection pool " + closeMode);
}
- this.pool.shutdown(shutdownType);
+ this.pool.close(closeMode);
this.log.debug("Connection pool shut down");
}
}
@@ -253,7 +253,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
if (log.isDebugEnabled()) {
log.debug("Connection " + ConnPoolSupport.getId(connection) + " is stale");
}
- poolEntry.discardConnection(ShutdownType.IMMEDIATE);
+ poolEntry.discardConnection(CloseMode.IMMEDIATE);
}
leaseCompleted(poolEntry);
}
@@ -264,7 +264,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
if (log.isDebugEnabled()) {
log.debug("Connection " + ConnPoolSupport.getId(connection) + " is closed");
}
- poolEntry.discardConnection(ShutdownType.IMMEDIATE);
+ poolEntry.discardConnection(CloseMode.IMMEDIATE);
}
leaseCompleted(poolEntry);
}
@@ -513,9 +513,9 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poolEntry = poolEntryRef.get();
if (poolEntry != null) {
if (log.isDebugEnabled()) {
- log.debug(id + ": shutdown " + ShutdownType.IMMEDIATE);
+ log.debug(id + ": shutdown " + CloseMode.IMMEDIATE);
}
- poolEntry.discardConnection(ShutdownType.IMMEDIATE);
+ poolEntry.discardConnection(CloseMode.IMMEDIATE);
}
}
@@ -524,9 +524,9 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
final PoolEntry<HttpRoute, ManagedAsyncClientConnection> poolEntry = poolEntryRef.get();
if (poolEntry != null) {
if (log.isDebugEnabled()) {
- log.debug(id + ": shutdown " + ShutdownType.GRACEFUL);
+ log.debug(id + ": shutdown " + CloseMode.GRACEFUL);
}
- poolEntry.discardConnection(ShutdownType.GRACEFUL);
+ poolEntry.discardConnection(CloseMode.GRACEFUL);
}
}
@@ -541,7 +541,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
return false;
}
if (!connection.isOpen()) {
- poolEntry.discardConnection(ShutdownType.IMMEDIATE);
+ poolEntry.discardConnection(CloseMode.IMMEDIATE);
return false;
}
return true;
@@ -549,16 +549,17 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
@Override
public void setSocketTimeout(final int timeout) {
- getValidatedPoolEntry().getConnection().setSocketTimeout(timeout);
+ getValidatedPoolEntry().getConnection().setSocketTimeoutMillis(timeout);
}
@Override
public void execute(final AsyncClientExchangeHandler exchangeHandler, final HttpContext context) {
final ManagedAsyncClientConnection connection = getValidatedPoolEntry().getConnection();
if (log.isDebugEnabled()) {
- log.debug(id + ": executing exchange " + ConnPoolSupport.getId(exchangeHandler) + " over " + ConnPoolSupport.getId(connection));
+ log.debug(id + ": executing exchange " + ConnPoolSupport.getId(exchangeHandler) +
+ " over " + ConnPoolSupport.getId(connection));
}
- connection.submitCommand(new ExecutionCommand(exchangeHandler, context));
+ connection.submitCommand(new RequestExecutionCommand(exchangeHandler, context));
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/io/ConnectionEndpoint.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/io/ConnectionEndpoint.java b/httpclient5/src/main/java/org/apache/hc/client5/http/io/ConnectionEndpoint.java
index 4812dcc..f62fc8a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/io/ConnectionEndpoint.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/io/ConnectionEndpoint.java
@@ -36,7 +36,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.GracefullyCloseable;
+import org.apache.hc.core5.io.ModalCloseable;
/**
* Client connection endpoint that can be used to execute message exchanges.
@@ -44,7 +44,7 @@ import org.apache.hc.core5.io.GracefullyCloseable;
* @since 5.0
*/
@Contract(threading = ThreadingBehavior.SAFE)
-public abstract class ConnectionEndpoint implements GracefullyCloseable {
+public abstract class ConnectionEndpoint implements ModalCloseable {
public abstract ClassicHttpResponse execute(
ClassicHttpRequest request,
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionManager.java
index 8826258..2d51fed 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionManager.java
@@ -30,7 +30,7 @@ import java.io.IOException;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.GracefullyCloseable;
+import org.apache.hc.core5.io.ModalCloseable;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
@@ -48,7 +48,7 @@ import org.apache.hc.core5.util.Timeout;
*
* @since 4.3
*/
-public interface HttpClientConnectionManager extends GracefullyCloseable {
+public interface HttpClientConnectionManager extends ModalCloseable {
/**
* Returns a {@link LeaseRequest} object which can be used to obtain
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionOperator.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionOperator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionOperator.java
index c472a95..e206d4d 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionOperator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/io/HttpClientConnectionOperator.java
@@ -32,7 +32,7 @@ import java.net.InetSocketAddress;
import org.apache.hc.core5.annotation.Internal;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.TimeValue;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/nio/AsyncClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/nio/AsyncClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/nio/AsyncClientConnectionManager.java
index 1211d86..b3519de 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/nio/AsyncClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/nio/AsyncClientConnectionManager.java
@@ -31,7 +31,7 @@ import java.util.concurrent.Future;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.GracefullyCloseable;
+import org.apache.hc.core5.io.ModalCloseable;
import org.apache.hc.core5.reactor.ConnectionInitiator;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
@@ -50,7 +50,7 @@ import org.apache.hc.core5.util.Timeout;
*
* @since 5.0
*/
-public interface AsyncClientConnectionManager extends GracefullyCloseable {
+public interface AsyncClientConnectionManager extends ModalCloseable {
/**
* Returns a {@link Future} object which can be used to obtain
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
index 6639ea1..eb064dc 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
@@ -50,7 +50,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
import org.apache.hc.core5.http2.ssl.H2TlsSupport;
import org.apache.hc.core5.net.NamedEndpoint;
-import org.apache.hc.core5.reactor.ssl.SSLBufferManagement;
+import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
import org.apache.hc.core5.reactor.ssl.SSLSessionInitializer;
import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
@@ -98,7 +98,7 @@ public class H2TlsStrategy implements TlsStrategy {
SSLContexts.createSystemDefault(),
split(getProperty("https.protocols")),
split(getProperty("https.cipherSuites")),
- SSLBufferManagement.STATIC,
+ SSLBufferMode.STATIC,
getDefaultHostnameVerifier());
}
@@ -107,27 +107,27 @@ public class H2TlsStrategy implements TlsStrategy {
private final SSLContext sslContext;
private final String[] supportedProtocols;
private final String[] supportedCipherSuites;
- private final SSLBufferManagement sslBufferManagement;
+ private final SSLBufferMode sslBufferManagement;
private final HostnameVerifier hostnameVerifier;
public H2TlsStrategy(
final SSLContext sslContext,
final String[] supportedProtocols,
final String[] supportedCipherSuites,
- final SSLBufferManagement sslBufferManagement,
+ final SSLBufferMode sslBufferManagement,
final HostnameVerifier hostnameVerifier) {
super();
this.sslContext = Args.notNull(sslContext, "SSL context");
this.supportedProtocols = supportedProtocols;
this.supportedCipherSuites = supportedCipherSuites;
- this.sslBufferManagement = sslBufferManagement != null ? sslBufferManagement : SSLBufferManagement.STATIC;
+ this.sslBufferManagement = sslBufferManagement != null ? sslBufferManagement : SSLBufferMode.STATIC;
this.hostnameVerifier = hostnameVerifier != null ? hostnameVerifier : getDefaultHostnameVerifier();
}
public H2TlsStrategy(
final SSLContext sslcontext,
final HostnameVerifier hostnameVerifier) {
- this(sslcontext, null, null, SSLBufferManagement.STATIC, hostnameVerifier);
+ this(sslcontext, null, null, SSLBufferMode.STATIC, hostnameVerifier);
}
public H2TlsStrategy(final SSLContext sslcontext) {
@@ -141,7 +141,7 @@ public class H2TlsStrategy implements TlsStrategy {
final SocketAddress localAddress,
final SocketAddress remoteAddress,
final Object attachment) {
- tlsSession.startTls(sslContext, sslBufferManagement, H2TlsSupport.enforceRequirements(attachment, new SSLSessionInitializer() {
+ tlsSession.startTls(sslContext, host, sslBufferManagement, H2TlsSupport.enforceRequirements(attachment, new SSLSessionInitializer() {
@Override
public void initialize(final NamedEndpoint endpoint, final SSLEngine sslEngine) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
index 8fd1df9..866bfaa 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestInternalExecRuntime.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.concurrent.CancellableDependency;
import org.apache.hc.core5.http.ConnectionRequestTimeoutException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
import org.junit.Assert;
@@ -127,7 +127,7 @@ public class TestInternalExecRuntime {
Mockito.when(mgr.lease(Mockito.eq(route), Mockito.<Timeout>any(), Mockito.any())).thenReturn(leaseRequest);
Mockito.when(leaseRequest.get(
- Mockito.anyLong(), Mockito.<TimeUnit>any())).thenThrow(new TimeoutException());
+ Mockito.anyLong(), Mockito.<TimeUnit>any())).thenThrow(new TimeoutException("timeout"));
execRuntime.acquireConnection(route, null, context);
}
@@ -156,12 +156,12 @@ public class TestInternalExecRuntime {
Assert.assertFalse(execRuntime.isConnectionAcquired());
- Mockito.verify(connectionEndpoint).shutdown(ShutdownType.IMMEDIATE);
+ Mockito.verify(connectionEndpoint).close(CloseMode.IMMEDIATE);
Mockito.verify(mgr).release(connectionEndpoint, null, TimeValue.ZERO_MILLISECONDS);
execRuntime.discardConnection();
- Mockito.verify(connectionEndpoint, Mockito.times(1)).shutdown(ShutdownType.IMMEDIATE);
+ Mockito.verify(connectionEndpoint, Mockito.times(1)).close(CloseMode.IMMEDIATE);
Mockito.verify(mgr, Mockito.times(1)).release(
Mockito.<ConnectionEndpoint>any(),
Mockito.any(),
@@ -183,12 +183,12 @@ public class TestInternalExecRuntime {
Assert.assertFalse(execRuntime.isConnectionAcquired());
- Mockito.verify(connectionEndpoint).shutdown(ShutdownType.IMMEDIATE);
+ Mockito.verify(connectionEndpoint).close(CloseMode.IMMEDIATE);
Mockito.verify(mgr).release(connectionEndpoint, null, TimeValue.ZERO_MILLISECONDS);
Assert.assertFalse(execRuntime.cancel());
- Mockito.verify(connectionEndpoint, Mockito.times(1)).shutdown(ShutdownType.IMMEDIATE);
+ Mockito.verify(connectionEndpoint, Mockito.times(1)).close(CloseMode.IMMEDIATE);
Mockito.verify(mgr, Mockito.times(1)).release(
Mockito.<ConnectionEndpoint>any(),
Mockito.any(),
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
index cf6d85f..9d0257b 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
@@ -43,10 +43,10 @@ import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.Lookup;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.util.TimeValue;
import org.junit.Assert;
import org.junit.Before;
@@ -192,7 +192,7 @@ public class TestBasicHttpClientConnectionManager {
Assert.assertNotNull(conn2);
Assert.assertFalse(conn2.isConnected());
- Mockito.verify(conn).shutdown(ShutdownType.GRACEFUL);
+ Mockito.verify(conn).close(CloseMode.GRACEFUL);
Mockito.verify(connFactory, Mockito.times(2)).createConnection(Mockito.<Socket>any());
}
@@ -223,7 +223,7 @@ public class TestBasicHttpClientConnectionManager {
Assert.assertNotNull(conn2);
Assert.assertFalse(conn2.isConnected());
- Mockito.verify(conn).shutdown(ShutdownType.GRACEFUL);
+ Mockito.verify(conn).close(CloseMode.GRACEFUL);
Mockito.verify(connFactory, Mockito.times(2)).createConnection(Mockito.<Socket>any());
}
@@ -257,7 +257,7 @@ public class TestBasicHttpClientConnectionManager {
mgr.close();
- Mockito.verify(conn, Mockito.times(1)).shutdown(ShutdownType.GRACEFUL);
+ Mockito.verify(conn, Mockito.times(1)).close(CloseMode.GRACEFUL);
try {
final LeaseRequest connRequest2 = mgr.lease(route, null);
@@ -271,7 +271,7 @@ public class TestBasicHttpClientConnectionManager {
mgr.closeIdle(0L, TimeUnit.MILLISECONDS);
mgr.close();
- Mockito.verify(conn, Mockito.times(1)).shutdown(ShutdownType.GRACEFUL);
+ Mockito.verify(conn, Mockito.times(1)).close(CloseMode.GRACEFUL);
}
@Test
@@ -298,7 +298,7 @@ public class TestBasicHttpClientConnectionManager {
mgr.closeExpired();
- Mockito.verify(conn).shutdown(ShutdownType.GRACEFUL);
+ Mockito.verify(conn).close(CloseMode.GRACEFUL);
}
@Test
@@ -325,7 +325,7 @@ public class TestBasicHttpClientConnectionManager {
mgr.closeIdle(50, TimeUnit.MILLISECONDS);
- Mockito.verify(conn).shutdown(ShutdownType.GRACEFUL);
+ Mockito.verify(conn).close(CloseMode.GRACEFUL);
}
@Test(expected=IllegalStateException.class)
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
index 07c0ac6..70eb81c 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
@@ -44,7 +44,7 @@ import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.Lookup;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.BasicHttpContext;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.TimeValue;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
index 7303701..3f56022 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
@@ -46,7 +46,7 @@ import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.Lookup;
-import org.apache.hc.core5.http.config.SocketConfig;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.pool.PoolEntry;
import org.apache.hc.core5.pool.StrictConnPool;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ae945a1..65cc3e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
- <httpcore.version>5.0-beta2</httpcore.version>
+ <httpcore.version>5.0-beta3</httpcore.version>
<log4j.version>2.9.1</log4j.version>
<commons-codec.version>1.11</commons-codec.version>
<ehcache.version>3.4.0</ehcache.version>
[2/2] httpcomponents-client git commit: Upgraded HttpCore dependency
to version 5.0-beta3
Posted by ol...@apache.org.
Upgraded HttpCore dependency to version 5.0-beta3
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/1614c251
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/1614c251
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/1614c251
Branch: refs/heads/master
Commit: 1614c2516806780c80ddb94fc1414233da1e5da2
Parents: 3aa9c1f
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Thu Aug 30 10:36:11 2018 +0200
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu Aug 30 10:54:54 2018 +0200
----------------------------------------------------------------------
httpclient5-cache/pom.xml | 3 +-
.../http/impl/cache/AsyncCachingExec.java | 22 +++----
.../cache/DefaultAsyncCacheRevalidator.java | 3 +-
httpclient5-fluent/pom.xml | 3 +-
httpclient5-testing/pom.xml | 3 +-
.../AbstractSimpleServerExchangeHandler.java | 4 +-
.../client5/testing/async/AsyncEchoHandler.java | 4 +-
.../testing/async/AsyncRandomHandler.java | 2 +-
.../async/AuthenticatingAsyncDecorator.java | 4 +-
.../async/AbstractHttp1IntegrationTestBase.java | 4 +-
.../async/AbstractIntegrationTestBase.java | 4 +-
.../testing/sync/LocalServerTestBase.java | 6 +-
.../testing/sync/TestSSLSocketFactory.java | 4 +-
httpclient5-win/pom.xml | 5 +-
httpclient5/pom.xml | 3 +-
.../examples/AsyncClientAuthentication.java | 4 +-
.../examples/AsyncClientConnectionEviction.java | 4 +-
.../http/examples/AsyncClientCustomSSL.java | 4 +-
.../examples/AsyncClientFullDuplexExchange.java | 20 ++++---
.../examples/AsyncClientHttp1Pipelining.java | 4 +-
.../AsyncClientHttp2FullDuplexExchange.java | 20 ++++---
.../examples/AsyncClientHttp2Multiplexing.java | 4 +-
.../examples/AsyncClientHttp2ServerPush.java | 4 +-
.../http/examples/AsyncClientHttpExchange.java | 4 +-
.../AsyncClientHttpExchangeStreaming.java | 4 +-
.../http/examples/AsyncClientInterceptors.java | 4 +-
.../examples/AsyncClientMessageTrailers.java | 4 +-
.../http/examples/AsyncClientTlsAlpn.java | 4 +-
.../http/examples/ClientConfiguration.java | 2 +-
.../client5/http/async/AsyncExecCallback.java | 4 +-
.../async/methods/AbstractBinPushConsumer.java | 4 +-
.../methods/AbstractBinResponseConsumer.java | 8 +++
.../async/methods/AbstractCharPushConsumer.java | 4 +-
.../methods/AbstractCharResponseConsumer.java | 8 +++
.../async/methods/SimpleResponseConsumer.java | 8 +++
.../impl/async/AbstractHttpAsyncClientBase.java | 10 ++--
.../http/impl/async/AsyncConnectExec.java | 6 +-
.../http/impl/async/AsyncProtocolExec.java | 3 +-
.../impl/async/CloseableHttpAsyncClient.java | 4 +-
.../impl/async/Http2AsyncClientBuilder.java | 5 +-
.../Http2AsyncClientEventHandlerFactory.java | 4 +-
.../impl/async/Http2AsyncMainClientExec.java | 12 ++--
.../http/impl/async/HttpAsyncClientBuilder.java | 5 +-
.../HttpAsyncClientEventHandlerFactory.java | 4 +-
.../impl/async/HttpAsyncMainClientExec.java | 16 ++++--
.../async/InternalAbstractHttpAsyncClient.java | 7 ++-
.../async/InternalHttp2AsyncExecRuntime.java | 19 ++++---
.../LoggingAsyncClientExchangeHandler.java | 21 ++++---
.../http/impl/async/LoggingIOSession.java | 60 +++++++++++---------
.../impl/async/MinimalHttp2AsyncClient.java | 40 ++++++++-----
.../http/impl/async/MinimalHttpAsyncClient.java | 33 +++++++----
.../impl/classic/CloseableHttpResponse.java | 8 +--
.../http/impl/classic/InternalExecRuntime.java | 4 +-
.../http/impl/classic/MainClientExec.java | 4 +-
.../http/impl/classic/MinimalHttpClient.java | 4 +-
.../io/BasicHttpClientConnectionManager.java | 30 +++++-----
.../io/DefaultHttpClientConnectionOperator.java | 2 +-
.../io/DefaultManagedHttpClientConnection.java | 16 +++---
.../io/PoolingHttpClientConnectionManager.java | 24 ++++----
...olingHttpClientConnectionManagerBuilder.java | 2 +-
.../DefaultManagedAsyncClientConnection.java | 59 ++++++++++---------
.../PoolingAsyncClientConnectionManager.java | 33 +++++------
.../hc/client5/http/io/ConnectionEndpoint.java | 4 +-
.../http/io/HttpClientConnectionManager.java | 4 +-
.../http/io/HttpClientConnectionOperator.java | 2 +-
.../http/nio/AsyncClientConnectionManager.java | 4 +-
.../hc/client5/http/ssl/H2TlsStrategy.java | 14 ++---
.../impl/classic/TestInternalExecRuntime.java | 12 ++--
.../TestBasicHttpClientConnectionManager.java | 16 +++---
.../io/TestHttpClientConnectionOperator.java | 2 +-
.../TestPoolingHttpClientConnectionManager.java | 2 +-
pom.xml | 2 +-
72 files changed, 404 insertions(+), 289 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-cache/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5-cache/pom.xml b/httpclient5-cache/pom.xml
index 37d8fa6..283844e 100644
--- a/httpclient5-cache/pom.xml
+++ b/httpclient5-cache/pom.xml
@@ -137,7 +137,8 @@
<source>${maven.compiler.source}</source>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
- <link>http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5-h2/apidocs/</link>
<link>http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/</link>
</links>
</configuration>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
index f45c1f2..2cb66f1 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
@@ -175,7 +175,8 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse response,
+ final EntityDetails entityDetails) throws HttpException, IOException {
return null;
}
@@ -305,7 +306,8 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse backendResponse, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse backendResponse,
+ final EntityDetails entityDetails) throws HttpException, IOException {
final Date responseDate = getCurrentDate();
backendResponse.addHeader("Via", generateViaHeader(backendResponse));
@@ -342,7 +344,6 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
private final AsyncExecCallback fallback;
private final HttpResponse backendResponse;
private final EntityDetails entityDetails;
- private final Date responseDate;
private final AtomicBoolean writtenThrough;
private final AtomicReference<ByteArrayBuffer> bufferRef;
private final AtomicReference<AsyncDataConsumer> dataConsumerRef;
@@ -350,11 +351,9 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
CachingAsyncDataConsumer(
final AsyncExecCallback fallback,
final HttpResponse backendResponse,
- final EntityDetails entityDetails,
- final Date responseDate) {
+ final EntityDetails entityDetails) {
this.fallback = fallback;
this.backendResponse = backendResponse;
- this.responseDate = responseDate;
this.entityDetails = entityDetails;
this.writtenThrough = new AtomicBoolean(false);
this.bufferRef = new AtomicReference<>(entityDetails != null ? new ByteArrayBuffer(1024) : null);
@@ -475,7 +474,7 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
});
final boolean cacheable = responseCachingPolicy.isResponseCacheable(request, backendResponse);
if (cacheable) {
- cachingConsumerRef.set(new CachingAsyncDataConsumer(asyncExecCallback, backendResponse, entityDetails, responseDate));
+ cachingConsumerRef.set(new CachingAsyncDataConsumer(asyncExecCallback, backendResponse, entityDetails));
storeRequestIfModifiedSinceFor304Response(request, backendResponse);
} else {
log.debug("Backend response is not cacheable");
@@ -764,7 +763,8 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse backendResponse1, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse backendResponse1,
+ final EntityDetails entityDetails) throws HttpException, IOException {
final Date responseDate1 = getCurrentDate();
@@ -783,7 +783,8 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse backendResponse2, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse backendResponse2,
+ final EntityDetails entityDetails) throws HttpException, IOException {
final Date responseDate2 = getCurrentDate();
final AsyncExecCallback callback2 = evaluateResponse(backendResponse2, responseDate2);
callbackRef.set(callback2);
@@ -966,7 +967,8 @@ public class AsyncCachingExec extends CachingExecBase implements AsyncExecChainH
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse backendResponse, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse backendResponse,
+ final EntityDetails entityDetails) throws HttpException, IOException {
final Date responseDate = getCurrentDate();
backendResponse.addHeader("Via", generateViaHeader(backendResponse));
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
index 446dc7a..7c9b4ea 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
@@ -124,7 +124,8 @@ class DefaultAsyncCacheRevalidator extends CacheRevalidatorBase {
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse response,
+ final EntityDetails entityDetails) throws HttpException, IOException {
responseRef.set(response);
return asyncExecCallback.handleResponse(response, entityDetails);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-fluent/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5-fluent/pom.xml b/httpclient5-fluent/pom.xml
index 271a35f..6c999f8 100644
--- a/httpclient5-fluent/pom.xml
+++ b/httpclient5-fluent/pom.xml
@@ -122,7 +122,8 @@
<source>${maven.compiler.source}</source>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
- <link>http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5-h2/apidocs/</link>
<link>http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/</link>
</links>
</configuration>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5-testing/pom.xml b/httpclient5-testing/pom.xml
index c2cf522..bec30b5 100644
--- a/httpclient5-testing/pom.xml
+++ b/httpclient5-testing/pom.xml
@@ -106,7 +106,8 @@
<source>${maven.compiler.source}</source>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
- <link>http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5-h2/apidocs/</link>
<link>http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/</link>
</links>
</configuration>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
index a88b576..650cceb 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
@@ -32,6 +32,7 @@ import org.apache.hc.client5.http.async.methods.SimpleBody;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.EntityDetails;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
@@ -53,6 +54,7 @@ public abstract class AbstractSimpleServerExchangeHandler extends AbstractServer
@Override
protected final AsyncRequestConsumer<SimpleHttpRequest> supplyConsumer(
final HttpRequest request,
+ final EntityDetails entityDetails,
final HttpContext context) throws HttpException {
return new AbstractAsyncRequesterConsumer<SimpleHttpRequest, byte[]>(new BasicAsyncEntityConsumer()) {
@@ -88,7 +90,7 @@ public abstract class AbstractSimpleServerExchangeHandler extends AbstractServer
} else {
entityProducer = null;
}
- responseTrigger.submitResponse(new BasicResponseProducer(response, entityProducer));
+ responseTrigger.submitResponse(new BasicResponseProducer(response, entityProducer), context);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
index 03bc189..98affe3 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
@@ -96,7 +96,7 @@ public class AsyncEchoHandler implements AsyncServerExchangeHandler {
final BasicAsyncEntityProducer entityProducer = new BasicAsyncEntityProducer(content, contentType);
entityProducerRef.set(entityProducer);
try {
- responseChannel.sendResponse(new BasicHttpResponse(HttpStatus.SC_OK), entityProducer);
+ responseChannel.sendResponse(new BasicHttpResponse(HttpStatus.SC_OK), entityProducer, context);
} catch (final IOException | HttpException ex) {
failed(ex);
}
@@ -114,7 +114,7 @@ public class AsyncEchoHandler implements AsyncServerExchangeHandler {
});
} else {
- responseChannel.sendResponse(new BasicHttpResponse(HttpStatus.SC_OK), null);
+ responseChannel.sendResponse(new BasicHttpResponse(HttpStatus.SC_OK), null, context);
entityConsumer.releaseResources();
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
index 5a3135b..3f6d543 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
@@ -111,7 +111,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK);
final AsyncEntityProducer entityProducer = new RandomBinAsyncEntityProducer(n);
entityProducerRef.set(entityProducer);
- responseChannel.sendResponse(response, entityProducer);
+ responseChannel.sendResponse(response, entityProducer, context);
} else {
throw new ProtocolException("Invalid request path: " + path);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
index d9cd69c..2a8b5a4 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
@@ -89,7 +89,7 @@ public class AuthenticatingAsyncDecorator implements AsyncServerExchangeHandler
if (authenticated) {
if (expectContinue) {
- responseChannel.sendInformation(new BasicClassicHttpResponse(HttpStatus.SC_CONTINUE));
+ responseChannel.sendInformation(new BasicClassicHttpResponse(HttpStatus.SC_CONTINUE), context);
}
exchangeHandler.handleRequest(request, entityDetails, responseChannel, context);
} else {
@@ -103,7 +103,7 @@ public class AuthenticatingAsyncDecorator implements AsyncServerExchangeHandler
unauthorized,
new BasicAsyncEntityProducer("Unauthorized", ContentType.TEXT_PLAIN));
responseProducerRef.set(responseProducer);
- responseProducer.sendResponse(responseChannel);
+ responseProducer.sendResponse(responseChannel, context);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
index fc3252b..05e4da6 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
@@ -44,7 +44,7 @@ import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.HttpProcessors;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.ListenerEndpoint;
import org.junit.Rule;
import org.junit.rules.ExternalResource;
@@ -99,7 +99,7 @@ public abstract class AbstractHttp1IntegrationTestBase extends AbstractServerTes
@Override
protected void after() {
if (httpclient != null) {
- httpclient.shutdown(ShutdownType.GRACEFUL);
+ httpclient.shutdown(CloseMode.GRACEFUL);
httpclient = null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
index c193785..808f5db 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.HttpProcessor;
import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.ListenerEndpoint;
import org.junit.Rule;
import org.junit.rules.ExternalResource;
@@ -63,7 +63,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
@Override
protected void after() {
if (httpclient != null) {
- httpclient.shutdown(ShutdownType.GRACEFUL);
+ httpclient.shutdown(CloseMode.GRACEFUL);
httpclient = null;
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
index f79bccb..ed0938b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
@@ -40,10 +40,10 @@ import org.apache.hc.client5.testing.classic.RandomHandler;
import org.apache.hc.core5.function.Decorator;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.io.HttpServerRequestHandler;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.testing.classic.ClassicTestServer;
import org.apache.hc.core5.util.Timeout;
import org.junit.Rule;
@@ -87,7 +87,7 @@ public abstract class LocalServerTestBase {
protected void after() {
if (server != null) {
try {
- server.shutdown(ShutdownType.IMMEDIATE);
+ server.shutdown(CloseMode.IMMEDIATE);
server = null;
} catch (final Exception ignore) {
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
index 51d16a0..4a946e8 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
@@ -54,7 +54,7 @@ import org.apache.hc.core5.http.impl.bootstrap.SSLServerSetupHandler;
import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.http.protocol.BasicHttpContext;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.TrustStrategy;
import org.apache.hc.core5.util.TimeValue;
@@ -72,7 +72,7 @@ public class TestSSLSocketFactory {
@After
public void shutDown() throws Exception {
if (this.server != null) {
- this.server.shutdown(ShutdownType.GRACEFUL);
+ this.server.close(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5-win/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5-win/pom.xml b/httpclient5-win/pom.xml
index 3f60cf1..da3c1c0 100644
--- a/httpclient5-win/pom.xml
+++ b/httpclient5-win/pom.xml
@@ -92,8 +92,9 @@
<quiet>true</quiet>
<source>${maven.compiler.source}</source>
<links>
- <link>http://docs.oracle.com/javase/6/docs/api/</link>
- <link>http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/</link>
+ <link>http://docs.oracle.com/javase/7/docs/api/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5-h2/apidocs/</link>
</links>
</configuration>
<reportSets>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/pom.xml
----------------------------------------------------------------------
diff --git a/httpclient5/pom.xml b/httpclient5/pom.xml
index 1f6ca7f..dca207d 100644
--- a/httpclient5/pom.xml
+++ b/httpclient5/pom.xml
@@ -134,7 +134,8 @@
<source>${maven.compiler.source}</source>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
- <link>http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5/apidocs/</link>
+ <link>http://hc.apache.org/httpcomponents-core-5.0.x/httpcore5-h2/apidocs/</link>
</links>
</configuration>
<reportSets>
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientAuthentication.java
index ce96a5c..c3287d0 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientAuthentication.java
@@ -37,7 +37,7 @@ import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.core5.concurrent.FutureCallback;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
/**
* A simple example that uses HttpClient to execute an HTTP request against
@@ -83,7 +83,7 @@ public class AsyncClientAuthentication {
future.get();
System.out.println("Shutting down");
- httpclient.shutdown(ShutdownType.GRACEFUL);
+ httpclient.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientConnectionEviction.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientConnectionEviction.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientConnectionEviction.java
index f53ef40..8f9d2cd 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientConnectionEviction.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientConnectionEviction.java
@@ -38,7 +38,7 @@ import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
@@ -121,7 +121,7 @@ public class AsyncClientConnectionEviction {
future2.get();
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
index cc8d2ff..8a92b71 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
@@ -47,7 +47,7 @@ import org.apache.hc.client5.http.ssl.H2TlsStrategy;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.TrustStrategy;
@@ -129,7 +129,7 @@ public class AsyncClientCustomSSL {
future.get();
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
index 47e612d..d2a7f7e 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
@@ -49,9 +49,10 @@ import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -101,8 +102,8 @@ public class AsyncClientFullDuplexExchange {
}
@Override
- public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
- requestProducer.sendRequest(channel);
+ public void produceRequest(final RequestChannel channel, final HttpContext context) throws HttpException, IOException {
+ requestProducer.sendRequest(channel, context);
}
@Override
@@ -116,14 +117,19 @@ public class AsyncClientFullDuplexExchange {
}
@Override
- public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+ public void consumeInformation(
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
System.out.println(requestUri + "->" + response.getCode());
}
@Override
- public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ public void consumeResponse(
+ final HttpResponse response,
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
System.out.println(requestUri + "->" + response.getCode());
- responseConsumer.consumeResponse(response, entityDetails, null);
+ responseConsumer.consumeResponse(response, entityDetails, context, null);
}
@Override
@@ -145,7 +151,7 @@ public class AsyncClientFullDuplexExchange {
latch.await(1, TimeUnit.MINUTES);
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
index 750d3c9..77afa34 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
import org.apache.hc.core5.http2.HttpVersionPolicy;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -103,7 +103,7 @@ public class AsyncClientHttp1Pipelining {
}
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
index 5df9ae0..e5cd96f 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
@@ -48,9 +48,10 @@ import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -97,8 +98,8 @@ public class AsyncClientHttp2FullDuplexExchange {
}
@Override
- public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
- requestProducer.sendRequest(channel);
+ public void produceRequest(final RequestChannel channel, final HttpContext context) throws HttpException, IOException {
+ requestProducer.sendRequest(channel, context);
}
@Override
@@ -112,14 +113,19 @@ public class AsyncClientHttp2FullDuplexExchange {
}
@Override
- public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+ public void consumeInformation(
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
System.out.println(requestUri + "->" + response.getCode());
}
@Override
- public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ public void consumeResponse(
+ final HttpResponse response,
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
System.out.println(requestUri + "->" + response.getCode());
- responseConsumer.consumeResponse(response, entityDetails, null);
+ responseConsumer.consumeResponse(response, entityDetails, context, null);
}
@Override
@@ -141,7 +147,7 @@ public class AsyncClientHttp2FullDuplexExchange {
latch.await(1, TimeUnit.MINUTES);
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java
index 02950e6..729ca18 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -104,7 +104,7 @@ public class AsyncClientHttp2Multiplexing {
}
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
index ecf8d2b..cd1c7dd 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
@@ -46,7 +46,7 @@ import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -159,7 +159,7 @@ public class AsyncClientHttp2ServerPush {
future.get();
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java
index ea42d2d..9d4c212 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java
@@ -35,7 +35,7 @@ import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -87,7 +87,7 @@ public class AsyncClientHttpExchange {
}
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
index 8f531be..52a5c17 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
@@ -39,7 +39,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.message.StatusLine;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -114,7 +114,7 @@ public class AsyncClientHttpExchangeStreaming {
}
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
index 53a24ed..50a19ab 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
@@ -56,7 +56,7 @@ import org.apache.hc.core5.http.message.BasicHttpResponse;
import org.apache.hc.core5.http.nio.AsyncDataConsumer;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -150,7 +150,7 @@ public class AsyncClientInterceptors {
}
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
index 7da44f3..0563bbe 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.AsyncRequestProducer;
import org.apache.hc.core5.http.nio.entity.DigestingEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -116,7 +116,7 @@ public class AsyncClientMessageTrailers {
future.get();
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
index 917945e..8c06824 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
import org.apache.hc.core5.http2.HttpVersionPolicy;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.ssl.SSLContexts;
/**
@@ -113,7 +113,7 @@ public class AsyncClientTlsAlpn {
future.get();
System.out.println("Shutting down");
- client.shutdown(ShutdownType.GRACEFUL);
+ client.shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConfiguration.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConfiguration.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConfiguration.java
index f9dfc9c..0a282b5 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConfiguration.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientConfiguration.java
@@ -65,7 +65,6 @@ import org.apache.hc.core5.http.config.CharCodingConfig;
import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.config.Registry;
import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.config.SocketConfig;
import org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory;
import org.apache.hc.core5.http.impl.io.DefaultHttpRequestWriterFactory;
import org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser;
@@ -74,6 +73,7 @@ import org.apache.hc.core5.http.io.HttpConnectionFactory;
import org.apache.hc.core5.http.io.HttpMessageParser;
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
+import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.message.BasicHeader;
import org.apache.hc.core5.http.message.BasicLineParser;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecCallback.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecCallback.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecCallback.java
index 120f225..dc75d6e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecCallback.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/AsyncExecCallback.java
@@ -35,7 +35,9 @@ import org.apache.hc.core5.http.nio.AsyncDataConsumer;
public interface AsyncExecCallback {
- AsyncDataConsumer handleResponse(HttpResponse response, EntityDetails entityDetails) throws HttpException, IOException;
+ AsyncDataConsumer handleResponse(
+ HttpResponse response,
+ EntityDetails entityDetails) throws HttpException, IOException;
void completed();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinPushConsumer.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinPushConsumer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinPushConsumer.java
index b5d94d7..7f79fd9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinPushConsumer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinPushConsumer.java
@@ -37,6 +37,7 @@ import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http.nio.entity.AbstractBinDataConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
public abstract class AbstractBinPushConsumer extends AbstractBinDataConsumer implements AsyncPushConsumer {
@@ -46,7 +47,8 @@ public abstract class AbstractBinPushConsumer extends AbstractBinDataConsumer im
public final void consumePromise(
final HttpRequest promise,
final HttpResponse response,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
if (entityDetails != null) {
final ContentType contentType;
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinResponseConsumer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinResponseConsumer.java
index b636114..b165c4f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinResponseConsumer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractBinResponseConsumer.java
@@ -37,6 +37,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncResponseConsumer;
import org.apache.hc.core5.http.nio.entity.AbstractBinDataConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
public abstract class AbstractBinResponseConsumer<T> extends AbstractBinDataConsumer implements AsyncResponseConsumer<T> {
@@ -47,9 +48,16 @@ public abstract class AbstractBinResponseConsumer<T> extends AbstractBinDataCons
protected abstract T buildResult();
@Override
+ public void informationResponse(
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
+ }
+
+ @Override
public final void consumeResponse(
final HttpResponse response,
final EntityDetails entityDetails,
+ final HttpContext context,
final FutureCallback<T> resultCallback) throws HttpException, IOException {
this.resultCallback = resultCallback;
if (entityDetails != null) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharPushConsumer.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharPushConsumer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharPushConsumer.java
index a5b3552..899d5a8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharPushConsumer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharPushConsumer.java
@@ -39,6 +39,7 @@ import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http.nio.entity.AbstractCharDataConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
public abstract class AbstractCharPushConsumer extends AbstractCharDataConsumer implements AsyncPushConsumer {
@@ -48,7 +49,8 @@ public abstract class AbstractCharPushConsumer extends AbstractCharDataConsumer
public final void consumePromise(
final HttpRequest promise,
final HttpResponse response,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
if (entityDetails != null) {
final ContentType contentType;
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharResponseConsumer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharResponseConsumer.java
index 93aacca..9dd5bfe 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharResponseConsumer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AbstractCharResponseConsumer.java
@@ -39,6 +39,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncResponseConsumer;
import org.apache.hc.core5.http.nio.entity.AbstractCharDataConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
public abstract class AbstractCharResponseConsumer<T> extends AbstractCharDataConsumer implements AsyncResponseConsumer<T> {
@@ -49,9 +50,16 @@ public abstract class AbstractCharResponseConsumer<T> extends AbstractCharDataCo
protected abstract T buildResult() throws IOException;
@Override
+ public void informationResponse(
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
+ }
+
+ @Override
public final void consumeResponse(
final HttpResponse response,
final EntityDetails entityDetails,
+ final HttpContext context,
final FutureCallback<T> resultCallback) throws HttpException, IOException {
this.resultCallback = resultCallback;
if (entityDetails != null) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java
index 395d1db..0b6aeed 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleResponseConsumer.java
@@ -26,11 +26,15 @@
*/
package org.apache.hc.client5.http.async.methods;
+import java.io.IOException;
+
import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncEntityConsumer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
import org.apache.hc.core5.http.nio.support.AbstractAsyncResponseConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
public final class SimpleResponseConsumer extends AbstractAsyncResponseConsumer<SimpleHttpResponse, byte[]> {
@@ -43,6 +47,10 @@ public final class SimpleResponseConsumer extends AbstractAsyncResponseConsumer<
}
@Override
+ public void informationResponse(final HttpResponse response, final HttpContext context) throws HttpException, IOException {
+ }
+
+ @Override
protected SimpleHttpResponse buildResult(final HttpResponse response, final byte[] entity, final ContentType contentType) {
final SimpleHttpResponse simpleResponse = SimpleHttpResponse.copy(response);
if (entity != null) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
index 8cf0793..3a18896 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
@@ -34,7 +34,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.hc.core5.function.Supplier;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.ConnectionInitiator;
import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
import org.apache.hc.core5.reactor.ExceptionEvent;
@@ -120,17 +120,17 @@ abstract class AbstractHttpAsyncClientBase extends CloseableHttpAsyncClient {
}
@Override
- public final void shutdown(final ShutdownType shutdownType) {
+ public final void shutdown(final CloseMode closeMode) {
if (log.isDebugEnabled()) {
- log.debug("Shutdown " + shutdownType);
+ log.debug("Shutdown " + closeMode);
}
ioReactor.initiateShutdown();
- ioReactor.shutdown(shutdownType);
+ ioReactor.close(closeMode);
}
@Override
public void close() {
- shutdown(ShutdownType.GRACEFUL);
+ shutdown(CloseMode.GRACEFUL);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncConnectExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncConnectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncConnectExec.java
index e82f273..577f44b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncConnectExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncConnectExec.java
@@ -247,7 +247,8 @@ public final class AsyncConnectExec implements AsyncExecChainHandler {
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse response,
+ final EntityDetails entityDetails) throws HttpException, IOException {
return asyncExecCallback.handleResponse(response, entityDetails);
}
@@ -326,7 +327,8 @@ public final class AsyncConnectExec implements AsyncExecChainHandler {
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse response,
+ final EntityDetails entityDetails) throws HttpException, IOException {
clientContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
proxyHttpProcessor.process(response, entityDetails, clientContext);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
index be88033..1fa9a50 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
@@ -171,7 +171,8 @@ class AsyncProtocolExec implements AsyncExecChainHandler {
@Override
public AsyncDataConsumer handleResponse(
- final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ final HttpResponse response,
+ final EntityDetails entityDetails) throws HttpException, IOException {
clientContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
httpProcessor.process(response, entityDetails, clientContext);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
index e153f21..2e82ee1 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http.nio.AsyncRequestProducer;
import org.apache.hc.core5.http.nio.AsyncResponseConsumer;
import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.ExceptionEvent;
import org.apache.hc.core5.reactor.IOReactorStatus;
import org.apache.hc.core5.util.Args;
@@ -69,7 +69,7 @@ public abstract class CloseableHttpAsyncClient implements HttpAsyncClient, Close
public abstract void initiateShutdown();
- public abstract void shutdown(ShutdownType shutdownType);
+ public abstract void shutdown(CloseMode closeMode);
public final <T> Future<T> execute(
final AsyncRequestProducer requestProducer,
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
index 1728709..fa26fac 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
@@ -105,7 +105,8 @@ import org.apache.hc.core5.http2.nio.pool.H2ConnPool;
import org.apache.hc.core5.http2.protocol.H2RequestConnControl;
import org.apache.hc.core5.http2.protocol.H2RequestContent;
import org.apache.hc.core5.http2.protocol.H2RequestTargetHost;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
+import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.IOReactorConfig;
@@ -720,7 +721,7 @@ public class Http2AsyncClientBuilder {
@Override
public void execute(final IOSession ioSession) {
- ioSession.addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+ ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE);
}
});
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
index 2349de5..44c9dcd 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http2.impl.nio.Http2OnlyClientProtocolNegotiator;
import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
import org.apache.hc.core5.reactor.IOEventHandler;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
-import org.apache.hc.core5.reactor.TlsCapableIOSession;
+import org.apache.hc.core5.reactor.ProtocolIOSession;
import org.apache.hc.core5.util.Args;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,7 +81,7 @@ class Http2AsyncClientEventHandlerFactory implements IOEventHandlerFactory {
}
@Override
- public IOEventHandler createHandler(final TlsCapableIOSession ioSession, final Object attachment) {
+ public IOEventHandler createHandler(final ProtocolIOSession ioSession, final Object attachment) {
final Logger sessionLog = LoggerFactory.getLogger(ioSession.getClass());
if (sessionLog.isDebugEnabled()
|| wireLog.isDebugEnabled()
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
index 802e405..1d982e9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
@@ -50,6 +50,7 @@ import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -97,8 +98,8 @@ class Http2AsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
- channel.sendRequest(request, entityProducer);
+ public void produceRequest(final RequestChannel channel, final HttpContext context) throws HttpException, IOException {
+ channel.sendRequest(request, entityProducer, context);
}
@Override
@@ -112,11 +113,14 @@ class Http2AsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+ public void consumeInformation(final HttpResponse response, final HttpContext context) throws HttpException, IOException {
}
@Override
- public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ public void consumeResponse(
+ final HttpResponse response,
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
entityConsumerRef.set(asyncExecCallback.handleResponse(response, entityDetails));
if (entityDetails == null) {
execRuntime.validateConnection();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
index e7316f9..525aa4a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
@@ -114,8 +114,9 @@ import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.http2.protocol.H2RequestConnControl;
import org.apache.hc.core5.http2.protocol.H2RequestContent;
import org.apache.hc.core5.http2.protocol.H2RequestTargetHost;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.pool.ConnPoolControl;
+import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.IOReactorConfig;
@@ -926,7 +927,7 @@ public class HttpAsyncClientBuilder {
@Override
public void execute(final IOSession ioSession) {
- ioSession.addFirst(new ShutdownCommand(ShutdownType.GRACEFUL));
+ ioSession.enqueue(new ShutdownCommand(CloseMode.GRACEFUL), Command.Priority.IMMEDIATE);
}
});
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
index f0d2784..67f5086 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
@@ -62,7 +62,7 @@ import org.apache.hc.core5.http2.impl.nio.ClientHttpProtocolNegotiator;
import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
import org.apache.hc.core5.reactor.IOEventHandler;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
-import org.apache.hc.core5.reactor.TlsCapableIOSession;
+import org.apache.hc.core5.reactor.ProtocolIOSession;
import org.apache.hc.core5.util.Args;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -110,7 +110,7 @@ class HttpAsyncClientEventHandlerFactory implements IOEventHandlerFactory {
}
@Override
- public IOEventHandler createHandler(final TlsCapableIOSession ioSession, final Object attachment) {
+ public IOEventHandler createHandler(final ProtocolIOSession ioSession, final Object attachment) {
final Logger sessionLog = LoggerFactory.getLogger(ioSession.getClass());
if (sessionLog.isDebugEnabled()
|| streamLog.isDebugEnabled()
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
index 1c8eabd..ff9556b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
@@ -55,6 +55,7 @@ import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.TimeValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -113,8 +114,10 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
- channel.sendRequest(request, entityProducer);
+ public void produceRequest(
+ final RequestChannel channel,
+ final HttpContext context) throws HttpException, IOException {
+ channel.sendRequest(request, entityProducer, context);
if (entityProducer == null) {
messageCountDown.decrementAndGet();
}
@@ -159,11 +162,16 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+ public void consumeInformation(
+ final HttpResponse response,
+ final HttpContext context) throws HttpException, IOException {
}
@Override
- public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+ public void consumeResponse(
+ final HttpResponse response,
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
entityConsumerRef.set(asyncExecCallback.handleResponse(response, entityDetails));
if (response.getCode() >= HttpStatus.SC_CLIENT_ERROR) {
messageCountDown.decrementAndGet();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java
index 916aec0..cf93234 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalAbstractHttpAsyncClient.java
@@ -146,7 +146,8 @@ abstract class InternalAbstractHttpAsyncClient extends AbstractHttpAsyncClientBa
@Override
public void sendRequest(
final HttpRequest request,
- final EntityDetails entityDetails) throws HttpException, IOException {
+ final EntityDetails entityDetails,
+ final HttpContext context) throws HttpException, IOException {
RequestConfig requestConfig = null;
if (request instanceof Configurable) {
@@ -237,7 +238,7 @@ abstract class InternalAbstractHttpAsyncClient extends AbstractHttpAsyncClientBa
outputTerminated.set(true);
requestProducer.releaseResources();
}
- responseConsumer.consumeResponse(response, entityDetails,
+ responseConsumer.consumeResponse(response, entityDetails, context,
new FutureCallback<T>() {
@Override
@@ -293,7 +294,7 @@ abstract class InternalAbstractHttpAsyncClient extends AbstractHttpAsyncClientBa
});
}
- });
+ }, context);
} catch (final HttpException | IOException ex) {
future.failed(ex);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/1614c251/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
index c589169..f5f3112 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
@@ -41,9 +41,10 @@ import org.apache.hc.core5.concurrent.ComplexCancellable;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
-import org.apache.hc.core5.http.nio.command.ExecutionCommand;
+import org.apache.hc.core5.http.nio.command.RequestExecutionCommand;
import org.apache.hc.core5.http2.nio.pool.H2ConnPool;
-import org.apache.hc.core5.io.ShutdownType;
+import org.apache.hc.core5.io.CloseMode;
+import org.apache.hc.core5.reactor.Command;
import org.apache.hc.core5.reactor.IOSession;
import org.apache.hc.core5.util.TimeValue;
import org.slf4j.Logger;
@@ -108,7 +109,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
public void releaseConnection() {
final Endpoint endpoint = sessionRef.getAndSet(null);
if (endpoint != null && !reusable) {
- endpoint.session.shutdown(ShutdownType.GRACEFUL);
+ endpoint.session.close(CloseMode.GRACEFUL);
}
}
@@ -116,7 +117,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
public void discardConnection() {
final Endpoint endpoint = sessionRef.getAndSet(null);
if (endpoint != null) {
- endpoint.session.shutdown(ShutdownType.GRACEFUL);
+ endpoint.session.close(CloseMode.GRACEFUL);
}
}
@@ -128,7 +129,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
}
final Endpoint endpoint = sessionRef.getAndSet(null);
if (endpoint != null) {
- endpoint.session.shutdown(ShutdownType.GRACEFUL);
+ endpoint.session.close(CloseMode.GRACEFUL);
}
return false;
}
@@ -196,7 +197,9 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": executing " + ConnPoolSupport.getId(exchangeHandler));
}
- session.addLast(new ExecutionCommand(exchangeHandler, complexCancellable, context));
+ session.enqueue(
+ new RequestExecutionCommand(exchangeHandler, null, complexCancellable, context),
+ Command.Priority.NORMAL);
} else {
final HttpHost target = endpoint.target;
final RequestConfig requestConfig = context.getRequestConfig();
@@ -209,7 +212,9 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
if (log.isDebugEnabled()) {
log.debug(ConnPoolSupport.getId(endpoint) + ": executing " + ConnPoolSupport.getId(exchangeHandler));
}
- session.addLast(new ExecutionCommand(exchangeHandler, complexCancellable, context));
+ session.enqueue(
+ new RequestExecutionCommand(exchangeHandler, null, complexCancellable, context),
+ Command.Priority.NORMAL);
}
@Override