HTTPCLIENT-1621: Possible NPE/incorrect type in HttpClientBuilder#evictIdleConnections

Method has been deprecated and a new one has been added with a simple type. Old method merely calls the new one now.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1663151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Osipov 2015-03-01 19:34:58 +00:00
parent d1da745d03
commit 542ccae502
1 changed files with 32 additions and 2 deletions

View File

@ -796,14 +796,44 @@ public class HttpClientBuilder {
* @see #setConnectionManagerShared(boolean)
* @see org.apache.http.conn.HttpClientConnectionManager#closeExpiredConnections()
*
* @param maxIdleTime maxium time persistent connections can stay idle while kept alive
* @param maxIdleTime maximum time persistent connections can stay idle while kept alive
* in the connection pool. Connections whose inactivity period exceeds this value will
* get closed and evicted from the pool.
* @param maxIdleTimeUnit time unit for the above parameter.
*
* @deprecated (4.5) use {@link #evictIdleConnections(long, TimeUnit)}
*
* @since 4.4
*/
@Deprecated
public final HttpClientBuilder evictIdleConnections(final Long maxIdleTime, final TimeUnit maxIdleTimeUnit) {
return evictIdleConnections(maxIdleTime.longValue(), maxIdleTimeUnit);
}
/**
* Makes this instance of HttpClient proactively evict idle connections from the
* connection pool using a background thread.
* <p>
* One MUST explicitly close HttpClient with {@link CloseableHttpClient#close()} in order
* to stop and release the background thread.
* <p>
* Please note this method has no effect if the instance of HttpClient is configuted to
* use a shared connection manager.
* <p>
* Please note this method may not be used when the instance of HttpClient is created
* inside an EJB container.
*
* @see #setConnectionManagerShared(boolean)
* @see org.apache.http.conn.HttpClientConnectionManager#closeExpiredConnections()
*
* @param maxIdleTime maximum time persistent connections can stay idle while kept alive
* in the connection pool. Connections whose inactivity period exceeds this value will
* get closed and evicted from the pool.
* @param maxIdleTimeUnit time unit for the above parameter.
*
* @since 4.4
*/
public final HttpClientBuilder evictIdleConnections(final Long maxIdleTime, final TimeUnit maxIdleTimeUnit) {
public final HttpClientBuilder evictIdleConnections(final long maxIdleTime, final TimeUnit maxIdleTimeUnit) {
this.evictIdleConnections = true;
this.maxIdleTime = maxIdleTime;
this.maxIdleTimeUnit = maxIdleTimeUnit;