Class RestClientTransportClientFactory

java.lang.Object
org.springframework.cloud.netflix.eureka.http.RestClientTransportClientFactory
All Implemented Interfaces:
com.netflix.discovery.shared.transport.TransportClientFactory

public class RestClientTransportClientFactory extends Object implements com.netflix.discovery.shared.transport.TransportClientFactory
Provides the custom RestClient required by the RestClientEurekaHttpClient. Relies on Jackson for serialization and deserialization.

A single ClientHttpRequestFactory (and the underlying HTTP client it wraps) is lazily built on the first call to newClient(com.netflix.discovery.shared.resolver.EurekaEndpoint) and reused for every subsequent call on this factory instance. Since each RestClientTransportClientFactory is already scoped to a single Eureka client, caching the request factory here - rather than in a potentially shared EurekaClientHttpRequestFactorySupplier - ties the shared client's lifecycle directly to this factory instance, so shutdown() only ever closes a client owned exclusively by this factory.

Since:
4.2.0
Author:
Wonchul Heo, Olga Maciaszek-Sharma
  • Constructor Details

  • Method Details

    • newClient

      public com.netflix.discovery.shared.transport.EurekaHttpClient newClient(com.netflix.discovery.shared.resolver.EurekaEndpoint endpoint)
      Specified by:
      newClient in interface com.netflix.discovery.shared.transport.TransportClientFactory
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface com.netflix.discovery.shared.transport.TransportClientFactory