private JerseyEurekaHttpClientFactory(EurekaJerseyClient jerseyClient, ApacheHttpClient4 apacheClient, long connectionIdleTimeout, Map<String, String> additionalHeaders) { this.jerseyClient = jerseyClient; this.apacheClient = jerseyClient != null ? jerseyClient.getClient() : apacheClient; this.additionalHeaders = additionalHeaders; if (jerseyClient == null) { // the jersey client contains a cleaner already so only create this cleaner if we don't have a jersey client this.cleaner = new ApacheHttpClientConnectionCleaner(this.apacheClient, connectionIdleTimeout); } else { this.cleaner = null; } }
@Override public void run() { cleanIdle(connectionIdleTimeout); } },
/** * Clean up resources. */ @Override public void destroyResources() { apacheHttpClientConnectionCleaner.shutdown(); apacheHttpClient.destroy(); }
public void shutdown() { cleanIdle(0); eurekaConnCleaner.shutdown(); }
@Override public void shutdown() { if (cleaner != null) { cleaner.shutdown(); } if (jerseyClient != null) { jerseyClient.destroyResources(); } else { apacheClient.destroy(); } }
public EurekaJerseyClientImpl(int connectionTimeout, int readTimeout, final int connectionIdleTimeout, ClientConfig clientConfig) { try { jerseyClientConfig = clientConfig; apacheHttpClient = ApacheHttpClient4.create(jerseyClientConfig); HttpParams params = apacheHttpClient.getClientHandler().getHttpClient().getParams(); HttpConnectionParams.setConnectionTimeout(params, connectionTimeout); HttpConnectionParams.setSoTimeout(params, readTimeout); this.apacheHttpClientConnectionCleaner = new ApacheHttpClientConnectionCleaner(apacheHttpClient, connectionIdleTimeout); } catch (Throwable e) { throw new RuntimeException("Cannot create Jersey client", e); } }
@Override public void run() { cleanIdle(connectionIdleTimeout); } },
/** * Clean up resources. */ @Override public void destroyResources() { apacheHttpClientConnectionCleaner.shutdown(); apacheHttpClient.destroy(); }
private JerseyEurekaHttpClientFactory(EurekaJerseyClient jerseyClient, ApacheHttpClient4 apacheClient, long connectionIdleTimeout, Map<String, String> additionalHeaders) { this.jerseyClient = jerseyClient; this.apacheClient = jerseyClient != null ? jerseyClient.getClient() : apacheClient; this.additionalHeaders = additionalHeaders; if (jerseyClient == null) { // the jersey client contains a cleaner already so only create this cleaner if we don't have a jersey client this.cleaner = new ApacheHttpClientConnectionCleaner(this.apacheClient, connectionIdleTimeout); } else { this.cleaner = null; } }
public void shutdown() { cleanIdle(0); eurekaConnCleaner.shutdown(); }
@Override public void shutdown() { if (cleaner != null) { cleaner.shutdown(); } if (jerseyClient != null) { jerseyClient.destroyResources(); } else { apacheClient.destroy(); } }
public EurekaJerseyClientImpl(int connectionTimeout, int readTimeout, final int connectionIdleTimeout, ClientConfig clientConfig) { try { jerseyClientConfig = clientConfig; apacheHttpClient = ApacheHttpClient4.create(jerseyClientConfig); HttpParams params = apacheHttpClient.getClientHandler().getHttpClient().getParams(); HttpConnectionParams.setConnectionTimeout(params, connectionTimeout); HttpConnectionParams.setSoTimeout(params, readTimeout); this.apacheHttpClientConnectionCleaner = new ApacheHttpClientConnectionCleaner(apacheHttpClient, connectionIdleTimeout); } catch (Throwable e) { throw new RuntimeException("Cannot create Jersey client", e); } }