/** * @param maxIdleTime * @param maxIdleTimeUnit * @return This object (for method chaining). * @see HttpClientBuilder#evictIdleConnections(long,TimeUnit) */ public RestClientBuilder evictIdleConnections(long maxIdleTime, TimeUnit maxIdleTimeUnit) { httpClientBuilder.evictIdleConnections(maxIdleTime, maxIdleTimeUnit); return this; }
/** * @param maxIdleTime * @param maxIdleTimeUnit * @return This object (for method chaining). * @see HttpClientBuilder#evictIdleConnections(long,TimeUnit) */ public RestClientBuilder evictIdleConnections(long maxIdleTime, TimeUnit maxIdleTimeUnit) { httpClientBuilder.evictIdleConnections(maxIdleTime, maxIdleTimeUnit); return this; }
/** * @param maxIdleTime * @param maxIdleTimeUnit * @return This object (for method chaining). * @see HttpClientBuilder#evictIdleConnections(long,TimeUnit) */ public RestClientBuilder evictIdleConnections(long maxIdleTime, TimeUnit maxIdleTimeUnit) { httpClientBuilder.evictIdleConnections(maxIdleTime, maxIdleTimeUnit); return this; }
/** * 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 CustomHttpClientBuilder evictIdleConnections(final long maxIdleTime, final TimeUnit maxIdleTimeUnit) { this.builder.evictIdleConnections(maxIdleTime, maxIdleTimeUnit); return this; }
/** * 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. * * @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. * * @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. * * @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. * * @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. * * @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); }
public ProxySpeechlet(ProxyServerConfig config) { this.config = config; this.httpClient = HttpClientBuilder .create() .disableAutomaticRetries() .setMaxConnTotal(30) .evictExpiredConnections() .evictIdleConnections(1000L, TimeUnit.MILLISECONDS) .setConnectionManager(new PoolingHttpClientConnectionManager(1000L, TimeUnit.MILLISECONDS)) .build(); this.gson = new Gson(); }
builder.setUserAgent(USERAGENT); builder.setConnectionTimeToLive(timeout, TimeUnit.SECONDS); builder.evictIdleConnections((long) timeout, TimeUnit.SECONDS);
.evictIdleConnections((long) Integer.getInteger(EVICT_IDLE_CONNECTIONS, EVICT_IDLE_CONNECTIONS_DEFAULT), TimeUnit.MILLISECONDS);
.setDefaultRequestConfig(requestConfig) .evictExpiredConnections() .evictIdleConnections(metadata.getIdleTimeout(), TimeUnit.MILLISECONDS) .setKeepAliveStrategy(new InfraConnectionKeepAliveStrategy(metadata.getIdleTimeout()));