Search in sources :

Example 1 with EurekaClientIdentity

use of com.netflix.appinfo.EurekaClientIdentity in project eureka by Netflix.

the class Jersey1TransportClientFactories method newTransportClientFactory.

public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig, final Collection<ClientFilter> additionalFilters, final InstanceInfo myInstanceInfo) {
    final TransportClientFactory jerseyFactory = JerseyEurekaHttpClientFactory.create(clientConfig, additionalFilters, myInstanceInfo, new EurekaClientIdentity(myInstanceInfo.getIPAddr()));
    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();
        }
    };
}
Also used : EurekaClientIdentity(com.netflix.appinfo.EurekaClientIdentity) TransportClientFactory(com.netflix.discovery.shared.transport.TransportClientFactory) EurekaEndpoint(com.netflix.discovery.shared.resolver.EurekaEndpoint)

Example 2 with EurekaClientIdentity

use of com.netflix.appinfo.EurekaClientIdentity 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();
        }
    };
}
Also used : EurekaClientIdentity(com.netflix.appinfo.EurekaClientIdentity) TransportClientFactory(com.netflix.discovery.shared.transport.TransportClientFactory) EurekaEndpoint(com.netflix.discovery.shared.resolver.EurekaEndpoint)

Aggregations

EurekaClientIdentity (com.netflix.appinfo.EurekaClientIdentity)2 EurekaEndpoint (com.netflix.discovery.shared.resolver.EurekaEndpoint)2 TransportClientFactory (com.netflix.discovery.shared.transport.TransportClientFactory)2