Class HttpTransportClient

java.lang.Object
com.linkedin.venice.client.store.transport.TransportClient
com.linkedin.venice.client.store.transport.HttpTransportClient
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
HttpsTransportClient

public class HttpTransportClient extends TransportClient
CloseableHttpAsyncClient based TransportClient implementation.
  • Field Details

    • routerUrl

      protected final String routerUrl
    • maxConnectionsTotal

      protected int maxConnectionsTotal
    • maxConnectionsPerRoute

      protected int maxConnectionsPerRoute
  • Constructor Details

    • HttpTransportClient

      public HttpTransportClient(String routerUrl, int maxConnectionsTotal, int maxConnectionsPerRoute)
    • HttpTransportClient

      public HttpTransportClient(String routerUrl, org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient httpClient)
  • Method Details

    • buildClient

      protected static org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient buildClient(String routerUrl, int maxConnectionsTotal, int maxConnectionsPerRoute, boolean requireHHtp2, SSLFactory sslFactory)
      Note: The callback that is triggered by CloseableHttpAsyncClient runs in the same thread as one of it's worker threads and if the users of the future run tasks that block the release of the future thread, a deadlock will occur. Hence, use the async handlers of CompletableFuture if you plan to use the same client to make multiple requests sequentially.
    • get

      public CompletableFuture<TransportClientResponse> get(String requestPath, Map<String,String> headers)
      Specified by:
      get in class TransportClient
    • post

      public CompletableFuture<TransportClientResponse> post(String requestPath, Map<String,String> headers, byte[] requestBody)
      Note: The callback that is triggered by CloseableHttpAsyncClient runs in the same thread as one of it's worker threads and if the users of the future run tasks that block the release of the future thread, a deadlock will occur. Hence, use the async handlers of CompletableFuture if you plan to use the same client to make multiple requests sequentially.
      Specified by:
      post in class TransportClient
    • streamPost

      public void streamPost(String requestPath, Map<String,String> headers, byte[] requestBody, TransportClientStreamingCallback callback, int keyCount)
      Leverage non-streaming post to achieve feature parity. Note: The callback that is triggered by CloseableHttpAsyncClient runs in the same thread as one of it's worker threads and if the users of the future run tasks that block the release of the future thread, a deadlock will occur. Hence, use the async handlers of CompletableFuture if you plan to use the same client to make multiple requests sequentially.
      Specified by:
      streamPost in class TransportClient
    • close

      public void close()
    • getCopyIfNotUsableInCallback

      public TransportClient getCopyIfNotUsableInCallback()
      The same CloseableHttpAsyncClient could not be used to send out another request in its own callback function.
      Overrides:
      getCopyIfNotUsableInCallback in class TransportClient
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMaxConnectionsTotal

      public int getMaxConnectionsTotal()
    • getMaxConnectionsPerRoute

      public int getMaxConnectionsPerRoute()