org.apache.http.impl.conn.DefaultHttpClientConnectionOperator Java Examples

The following examples show how to use org.apache.http.impl.conn.DefaultHttpClientConnectionOperator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SharedHttpClientConnectionManager.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public SharedHttpClientConnectionManager(
    final List<SSLContextSelector> sslContextSelectors,
    @Named("${nexus.httpclient.connectionpool.size:-20}") final int connectionPoolSize,
    @Named("${nexus.httpclient.connectionpool.maxSize:-200}") final int connectionPoolMaxSize,
    @Named("${nexus.httpclient.connectionpool.idleTime:-30s}") final Time connectionPoolIdleTime,
    @Named("${nexus.httpclient.connectionpool.evictingDelayTime:-5s}") final Time connectionPoolEvictingDelayTime,
    @Named("${nexus.httpclient.connectionpool.validateAfterInactivityTime:-2s}") final Time connectionPoolValidateAfterInactivityTime,
    @Named("${nexus.httpclient.connectionpool.default.requestTimeout:-20s}") final Time defaultSocketTimeout)
{
  super(
      new DefaultHttpClientConnectionOperator(createRegistry(sslContextSelectors), null, null),
      null,
      connectionPoolIdleTime.toMillis(),
      TimeUnit.MILLISECONDS
  );

  setMaxTotal(connectionPoolMaxSize);
  log.debug("Connection pool max-size: {}", connectionPoolMaxSize);

  setDefaultMaxPerRoute(Math.min(connectionPoolSize, connectionPoolMaxSize));
  log.debug("Connection pool size: {}", connectionPoolSize);

  this.connectionPoolIdleTime = checkNotNull(connectionPoolIdleTime);
  this.connectionPoolEvictingDelayTime = checkNotNull(connectionPoolEvictingDelayTime);
  setValidateAfterInactivity(connectionPoolValidateAfterInactivityTime.toMillisI());
  log.debug("Connection pool idle-time: {}, evicting delay: {}, validate after inactivity: {}",
      connectionPoolIdleTime, connectionPoolEvictingDelayTime, connectionPoolValidateAfterInactivityTime);

  setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(defaultSocketTimeout.toMillisI()).build());
  log.debug("Default socket timeout {}", defaultSocketTimeout);
}
 
Example #2
Source File: FeignHttpClientConfigurationTests.java    From spring-cloud-openfeign with Apache License 2.0 4 votes vote down vote up
private Lookup<ConnectionSocketFactory> getConnectionSocketFactoryLookup(
		HttpClientConnectionManager connectionManager) {
	DefaultHttpClientConnectionOperator connectionOperator = (DefaultHttpClientConnectionOperator) this
			.getField(connectionManager, "connectionOperator");
	return (Lookup) this.getField(connectionOperator, "socketFactoryRegistry");
}
 
Example #3
Source File: DefaultApacheHttpClientConnectionManagerFactoryTests.java    From spring-cloud-commons with Apache License 2.0 4 votes vote down vote up
private Lookup<ConnectionSocketFactory> getConnectionSocketFactoryLookup(
		HttpClientConnectionManager connectionManager) {
	DefaultHttpClientConnectionOperator connectionOperator = getField(
			connectionManager, "connectionOperator");
	return getField(connectionOperator, "socketFactoryRegistry");
}