You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/09/05 20:13:25 UTC
httpcomponents-core git commit: Added lease request timeout parameter
to #lease method of ConnPool interface
Repository: httpcomponents-core
Updated Branches:
refs/heads/master 572fd1700 -> b95783f4e
Added lease request timeout parameter to #lease method of ConnPool interface
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/b95783f4
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/b95783f4
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/b95783f4
Branch: refs/heads/master
Commit: b95783f4efcc471b498011510a05f67145f14a44
Parents: 572fd17
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Sep 5 22:04:08 2017 +0200
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Sep 5 22:06:31 2017 +0200
----------------------------------------------------------------------
.../examples/Http2MultiStreamExecutionExample.java | 4 ++--
.../http/examples/Http2RequestExecutionExample.java | 4 ++--
.../examples/Http2SSLRequestExecutionExample.java | 4 ++--
.../impl/nio/bootstrap/Http2AsyncRequester.java | 4 ++--
.../testing/nio/Http1ServerAndRequesterTest.java | 5 ++---
.../testing/nio/Http2ServerAndRequesterTest.java | 5 ++---
.../AsyncPipelinedRequestExecutionExample.java | 4 ++--
.../http/examples/AsyncRequestExecutionExample.java | 4 ++--
.../http/examples/AsyncReverseProxyExample.java | 3 ++-
.../http/impl/bootstrap/HttpAsyncRequester.java | 15 ++++++++-------
.../hc/core5/http/impl/bootstrap/HttpRequester.java | 2 +-
.../main/java/org/apache/hc/core5/pool/ConnPool.java | 4 +++-
.../java/org/apache/hc/core5/pool/LaxConnPool.java | 7 +------
.../org/apache/hc/core5/pool/StrictConnPool.java | 6 +-----
.../org/apache/hc/core5/pool/TestLaxConnPool.java | 5 -----
15 files changed, 32 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java
index 8397616..ec85ce1 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java
+++ b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2MultiStreamExecutionExample.java
@@ -46,7 +46,7 @@ import org.apache.hc.core5.http2.frame.RawFrame;
import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
import org.apache.hc.core5.http2.impl.nio.bootstrap.H2RequesterBootstrap;
import org.apache.hc.core5.io.ShutdownType;
-import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* Example of HTTP/2 concurrent request execution using multiple streams.
@@ -108,7 +108,7 @@ public class Http2MultiStreamExecutionExample {
HttpHost target = new HttpHost("http2bin.org");
String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
- Future<AsyncClientEndpoint> future = requester.connect(target, TimeValue.ofSeconds(5));
+ Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
AsyncClientEndpoint clientEndpoint = future.get();
final CountDownLatch latch = new CountDownLatch(requestUris.length);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java
index 28a0014..bd07a25 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java
+++ b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2RequestExecutionExample.java
@@ -46,7 +46,7 @@ import org.apache.hc.core5.http2.frame.RawFrame;
import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
import org.apache.hc.core5.http2.impl.nio.bootstrap.H2RequesterBootstrap;
import org.apache.hc.core5.io.ShutdownType;
-import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* Example of HTTP/2 request execution.
@@ -110,7 +110,7 @@ public class Http2RequestExecutionExample {
final CountDownLatch latch = new CountDownLatch(requestUris.length);
for (final String requestUri: requestUris) {
- final Future<AsyncClientEndpoint> future = requester.connect(target, TimeValue.ofSeconds(5));
+ final Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
final AsyncClientEndpoint clientEndpoint = future.get();
clientEndpoint.execute(
new BasicRequestProducer("GET", target, requestUri),
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2SSLRequestExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2SSLRequestExecutionExample.java b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2SSLRequestExecutionExample.java
index 00ef85f..ea6a185 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2SSLRequestExecutionExample.java
+++ b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2SSLRequestExecutionExample.java
@@ -58,7 +58,7 @@ import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.TrustStrategy;
-import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* This example demonstrates how to execute HTTP/2 requests over TLS connections.
@@ -154,7 +154,7 @@ public class Http2SSLRequestExecutionExample {
final CountDownLatch latch = new CountDownLatch(requestUris.length);
for (final String requestUri: requestUris) {
- final Future<AsyncClientEndpoint> future = requester.connect(target, TimeValue.ofSeconds(5));
+ final Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
final AsyncClientEndpoint clientEndpoint = future.get();
clientEndpoint.execute(
new BasicRequestProducer("GET", target, requestUri),
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
index 63bb05d..1543a42 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.reactor.IOSession;
import org.apache.hc.core5.reactor.IOSessionListener;
-import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* @since 5.0
@@ -65,7 +65,7 @@ public class Http2AsyncRequester extends HttpAsyncRequester {
@Override
protected Future<AsyncClientEndpoint> doConnect(
final HttpHost host,
- final TimeValue timeout,
+ final Timeout timeout,
final Object attachment,
final FutureCallback<AsyncClientEndpoint> callback) {
return super.doConnect(host, timeout, attachment != null ? attachment : versionPolicy, callback);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
index 2172ca9..39893d5 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
@@ -68,7 +68,6 @@ import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.reactor.ListenerEndpoint;
import org.apache.hc.core5.testing.classic.LoggingConnPoolListener;
import org.apache.hc.core5.testing.classic.LoggingHttp1StreamListener;
-import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -304,7 +303,7 @@ public class Http1ServerAndRequesterTest {
requester.start();
final HttpHost target = new HttpHost("localhost", address.getPort());
- final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, TimeValue.ofSeconds(5));
+ final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, Timeout.ofSeconds(5));
final AsyncClientEndpoint endpoint = endpointFuture.get(TIMEOUT.getDuration(), TIMEOUT.getTimeUnit());
try {
@@ -355,7 +354,7 @@ public class Http1ServerAndRequesterTest {
requester.start();
final HttpHost target = new HttpHost("localhost", address.getPort());
- final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, TimeValue.ofSeconds(5));
+ final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, Timeout.ofSeconds(5));
final AsyncClientEndpoint endpoint = endpointFuture.get(TIMEOUT.getDuration(), TIMEOUT.getTimeUnit());
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ServerAndRequesterTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ServerAndRequesterTest.java
index 6f3c19a..aeab0fa 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ServerAndRequesterTest.java
@@ -58,7 +58,6 @@ import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.reactor.ListenerEndpoint;
import org.apache.hc.core5.testing.classic.LoggingConnPoolListener;
import org.apache.hc.core5.testing.classic.LoggingHttp1StreamListener;
-import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -234,7 +233,7 @@ public class Http2ServerAndRequesterTest {
requester.start();
final HttpHost target = new HttpHost("localhost", address.getPort());
- final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, TimeValue.ofSeconds(5));
+ final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, Timeout.ofSeconds(5));
final AsyncClientEndpoint endpoint = endpointFuture.get(TIMEOUT.getDuration(), TIMEOUT.getTimeUnit());
try {
@@ -285,7 +284,7 @@ public class Http2ServerAndRequesterTest {
requester.start();
final HttpHost target = new HttpHost("localhost", address.getPort());
- final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, TimeValue.ofSeconds(5));
+ final Future<AsyncClientEndpoint> endpointFuture = requester.connect(target, Timeout.ofSeconds(5));
final AsyncClientEndpoint endpoint = endpointFuture.get(TIMEOUT.getDuration(), TIMEOUT.getTimeUnit());
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
index ffd055a..e122c4d 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncPipelinedRequestExecutionExample.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http.nio.BasicResponseConsumer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
import org.apache.hc.core5.io.ShutdownType;
import org.apache.hc.core5.reactor.IOReactorConfig;
-import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* Example of asynchronous HTTP/1.1 request execution.
@@ -100,7 +100,7 @@ public class AsyncPipelinedRequestExecutionExample {
HttpHost target = new HttpHost("httpbin.org");
String[] requestUris = new String[] {"/", "/ip", "/user-agent", "/headers"};
- Future<AsyncClientEndpoint> future = requester.connect(target, TimeValue.ofSeconds(5));
+ Future<AsyncClientEndpoint> future = requester.connect(target, Timeout.ofSeconds(5));
AsyncClientEndpoint clientEndpoint = future.get();
final CountDownLatch latch = new CountDownLatch(requestUris.length);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
index a5491a4..2d65fb3 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncRequestExecutionExample.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.nio.BasicResponseConsumer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
import org.apache.hc.core5.io.ShutdownType;
import org.apache.hc.core5.reactor.IOReactorConfig;
-import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* Example of asynchronous HTTP/1.1 request execution.
@@ -103,7 +103,7 @@ public class AsyncRequestExecutionExample {
requester.execute(
new BasicRequestProducer("GET", target, requestUri),
new BasicResponseConsumer<>(new StringAsyncEntityConsumer()),
- TimeValue.ofSeconds(5),
+ Timeout.ofSeconds(5),
new FutureCallback<Message<HttpResponse, String>>() {
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index d0e7006..41452a0 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -79,6 +79,7 @@ import org.apache.hc.core5.pool.ConnPoolStats;
import org.apache.hc.core5.pool.PoolStats;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* Example of asynchronous embedded HTTP/1.1 reverse proxy with full content streaming.
@@ -286,7 +287,7 @@ public class AsyncReverseProxyExample {
System.out.println("[proxy->origin] " + exchangeState.id + " request connection to " + targetHost);
- requester.connect(targetHost, TimeValue.ofSeconds(30), null, new FutureCallback<AsyncClientEndpoint>() {
+ requester.connect(targetHost, Timeout.ofSeconds(30), null, new FutureCallback<AsyncClientEndpoint>() {
@Override
public void completed(final AsyncClientEndpoint clientEndpoint) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
index 5c63611..0b4e0d2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
@@ -73,6 +73,7 @@ import org.apache.hc.core5.reactor.IOSessionListener;
import org.apache.hc.core5.reactor.ssl.TransportSecurityLayer;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
+import org.apache.hc.core5.util.Timeout;
/**
* @since 5.0
@@ -158,7 +159,7 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
public Future<AsyncClientEndpoint> connect(
final HttpHost host,
- final TimeValue timeout,
+ final Timeout timeout,
final Object attachment,
final FutureCallback<AsyncClientEndpoint> callback) {
return doConnect(host, timeout, attachment, callback);
@@ -166,14 +167,14 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
protected Future<AsyncClientEndpoint> doConnect(
final HttpHost host,
- final TimeValue timeout,
+ final Timeout timeout,
final Object attachment,
final FutureCallback<AsyncClientEndpoint> callback) {
Args.notNull(host, "Host");
Args.notNull(timeout, "Timeout");
final ComplexFuture<AsyncClientEndpoint> resultFuture = new ComplexFuture<>(callback);
final Future<PoolEntry<HttpHost, IOSession>> leaseFuture = connPool.lease(
- host, null, new FutureCallback<PoolEntry<HttpHost, IOSession>>() {
+ host, null, timeout, new FutureCallback<PoolEntry<HttpHost, IOSession>>() {
@Override
public void completed(final PoolEntry<HttpHost, IOSession> poolEntry) {
@@ -242,13 +243,13 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
return resultFuture;
}
- public Future<AsyncClientEndpoint> connect(final HttpHost host, final TimeValue timeout) throws InterruptedException {
+ public Future<AsyncClientEndpoint> connect(final HttpHost host, final Timeout timeout) throws InterruptedException {
return connect(host, timeout, null, null);
}
public void execute(
final AsyncClientExchangeHandler exchangeHandler,
- final TimeValue timeout,
+ final Timeout timeout,
final HttpContext context) {
Args.notNull(exchangeHandler, "Exchange handler");
Args.notNull(timeout, "Timeout");
@@ -363,7 +364,7 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
public final <T> Future<T> execute(
final AsyncRequestProducer requestProducer,
final AsyncResponseConsumer<T> responseConsumer,
- final TimeValue timeout,
+ final Timeout timeout,
final HttpContext context,
final FutureCallback<T> callback) {
Args.notNull(requestProducer, "Request producer");
@@ -395,7 +396,7 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
public final <T> Future<T> execute(
final AsyncRequestProducer requestProducer,
final AsyncResponseConsumer<T> responseConsumer,
- final TimeValue timeout,
+ final Timeout timeout,
final FutureCallback<T> callback) {
return execute(requestProducer, responseConsumer, timeout, null, callback);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
index b6489d6..65dac19 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
@@ -261,7 +261,7 @@ public class HttpRequester implements ConnPoolControl<HttpHost>, GracefullyClose
final HttpContext context) throws HttpException, IOException {
Args.notNull(targetHost, "HTTP host");
Args.notNull(request, "HTTP request");
- final Future<PoolEntry<HttpHost, HttpClientConnection>> leaseFuture = connPool.lease(targetHost, null, null);
+ final Future<PoolEntry<HttpHost, HttpClientConnection>> leaseFuture = connPool.lease(targetHost, null, connectTimeout, null);
final PoolEntry<HttpHost, HttpClientConnection> poolEntry;
final Timeout timeout = Timeout.defaultsToDisabled(connectTimeout);
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/main/java/org/apache/hc/core5/pool/ConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/ConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/ConnPool.java
index 36549cb..c1f9166 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/ConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/ConnPool.java
@@ -30,6 +30,7 @@ import java.util.concurrent.Future;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.io.GracefullyCloseable;
+import org.apache.hc.core5.util.Timeout;
/**
* {@code ConnPool} represents a shared pool connections can be leased from
@@ -51,11 +52,12 @@ public interface ConnPool<T, C extends GracefullyCloseable> {
* (usually a security principal or a unique token identifying
* the user whose credentials have been used while establishing the connection).
* May be {@code null}.
+ * @param requestTimeout request timeout.
* @param callback operation completion callback.
*
* @return future for a leased pool entry.
*/
- Future<PoolEntry<T, C>> lease(final T route, final Object state, final FutureCallback<PoolEntry<T, C>> callback);
+ Future<PoolEntry<T, C>> lease(T route, Object state, Timeout requestTimeout, FutureCallback<PoolEntry<T, C>> callback);
/**
* Releases the pool entry back to the pool.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
index 12347e2..f4da7ab 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
@@ -132,22 +132,17 @@ public class LaxConnPool<T, C extends GracefullyCloseable> implements ManagedCon
return routePool;
}
+ @Override
public Future<PoolEntry<T, C>> lease(
final T route, final Object state,
final Timeout requestTimeout,
final FutureCallback<PoolEntry<T, C>> callback) {
Args.notNull(route, "Route");
- Args.notNull(requestTimeout, "Request timeout");
Asserts.check(!isShutDown.get(), "Connection pool shut down");
final PerRoutePool<T, C> routePool = getPool(route);
return routePool.lease(state, requestTimeout, callback);
}
- @Override
- public Future<PoolEntry<T, C>> lease(final T route, final Object state, final FutureCallback<PoolEntry<T, C>> callback) {
- return lease(route, state, Timeout.DISABLED, callback);
- }
-
public Future<PoolEntry<T, C>> lease(final T route, final Object state) {
return lease(route, state, Timeout.DISABLED, null);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
index a776747..1f88514 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
@@ -147,6 +147,7 @@ public class StrictConnPool<T, C extends GracefullyCloseable> implements Managed
return pool;
}
+ @Override
public Future<PoolEntry<T, C>> lease(
final T route, final Object state,
final Timeout requestTimeout,
@@ -172,11 +173,6 @@ public class StrictConnPool<T, C extends GracefullyCloseable> implements Managed
return future;
}
- @Override
- public Future<PoolEntry<T, C>> lease(final T route, final Object state, final FutureCallback<PoolEntry<T, C>> callback) {
- return lease(route, state, Timeout.DISABLED, callback);
- }
-
public Future<PoolEntry<T, C>> lease(final T route, final Object state) {
return lease(route, state, Timeout.DISABLED, null);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/b95783f4/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java b/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
index 01207b3..3a8f2dd 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
@@ -108,11 +108,6 @@ public class TestLaxConnPool {
Assert.fail("IllegalArgumentException should have been thrown");
} catch (final IllegalArgumentException expected) {
}
- try {
- pool.lease("somehost", null, null, null);
- Assert.fail("IllegalArgumentException should have been thrown");
- } catch (final IllegalArgumentException expected) {
- }
}
@Test(expected = IllegalStateException.class)