use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class Jersey2TransportClientFactories method newTransportClientFactory.
@Override
public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig, final Collection<ClientRequestFilter> additionalFilters, final InstanceInfo myInstanceInfo) {
final TransportClientFactory jerseyFactory = Jersey2ApplicationClientFactory.create(clientConfig, additionalFilters, myInstanceInfo, new EurekaClientIdentity(myInstanceInfo.getIPAddr(), "Jersey2DefaultClient"));
final TransportClientFactory metricsFactory = MetricsCollectingEurekaHttpClient.createFactory(jerseyFactory);
return new TransportClientFactory() {
@Override
public EurekaHttpClient newClient(EurekaEndpoint serviceUrl) {
return metricsFactory.newClient(serviceUrl);
}
@Override
public void shutdown() {
metricsFactory.shutdown();
jerseyFactory.shutdown();
}
};
}
use of com.netflix.discovery.shared.transport.TransportClientFactory in project eureka by Netflix.
the class JerseyApplicationClientTest method getEurekaHttpClient.
@Override
protected EurekaHttpClient getEurekaHttpClient(URI serviceURI) {
Preconditions.checkState(jerseyHttpClient == null, "EurekaHttpClient has been already created");
TransportClientFactory clientFactory = JerseyEurekaHttpClientFactory.newBuilder().withClientName("compatibilityTestClient").build();
jerseyHttpClient = (JerseyApplicationClient) clientFactory.newClient(new DefaultEndpoint(serviceURI.toString()));
return jerseyHttpClient;
}
Aggregations