io.searchbox.client.config.idle.HttpReapableConnectionManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jest Show documentation
Show all versions of jest Show documentation
ElasticSearch Java REST client - Apache HTTP Client package
package io.searchbox.client.config.idle;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.nio.conn.NHttpClientConnectionManager;
import java.util.concurrent.TimeUnit;
public class HttpReapableConnectionManager implements ReapableConnectionManager {
private final HttpClientConnectionManager connectionManager;
private final NHttpClientConnectionManager nConnectionManager;
public HttpReapableConnectionManager(HttpClientConnectionManager connectionManager, NHttpClientConnectionManager nConnectionManager) {
if(connectionManager == null || nConnectionManager == null) throw new IllegalArgumentException();
this.connectionManager = connectionManager;
this.nConnectionManager = nConnectionManager;
}
@Override
public void closeIdleConnections(long idleTimeout, TimeUnit unit) {
connectionManager.closeIdleConnections(idleTimeout, unit);
nConnectionManager.closeIdleConnections(idleTimeout, unit);
}
}