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
CloseableHttpAsyncClient
based TransportClient implementation.-
Field Summary
Fields inherited from class com.linkedin.venice.client.store.transport.TransportClient
HTTPS
-
Constructor Summary
ConstructorDescriptionHttpTransportClient
(String routerUrl, int maxConnectionsTotal, int maxConnectionsPerRoute) HttpTransportClient
(String routerUrl, org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient httpClient) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 byCloseableHttpAsyncClient
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.void
close()
The sameCloseableHttpAsyncClient
could not be used to send out another request in its own callback function.int
int
Note: The callback that is triggered byCloseableHttpAsyncClient
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.void
streamPost
(String requestPath, Map<String, String> headers, byte[] requestBody, TransportClientStreamingCallback callback, int keyCount) Leverage non-streaming post to achieve feature parity.toString()
Methods inherited from class com.linkedin.venice.client.store.transport.TransportClient
get, post
-
Field Details
-
routerUrl
-
maxConnectionsTotal
protected int maxConnectionsTotal -
maxConnectionsPerRoute
protected int maxConnectionsPerRoute
-
-
Constructor Details
-
HttpTransportClient
-
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 byCloseableHttpAsyncClient
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 ofCompletableFuture
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 classTransportClient
-
post
public CompletableFuture<TransportClientResponse> post(String requestPath, Map<String, String> headers, byte[] requestBody) Note: The callback that is triggered byCloseableHttpAsyncClient
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 ofCompletableFuture
if you plan to use the same client to make multiple requests sequentially.- Specified by:
post
in classTransportClient
-
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 byCloseableHttpAsyncClient
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 ofCompletableFuture
if you plan to use the same client to make multiple requests sequentially.- Specified by:
streamPost
in classTransportClient
-
close
public void close() -
getCopyIfNotUsableInCallback
The sameCloseableHttpAsyncClient
could not be used to send out another request in its own callback function.- Overrides:
getCopyIfNotUsableInCallback
in classTransportClient
- Returns:
-
toString
-
getMaxConnectionsTotal
public int getMaxConnectionsTotal() -
getMaxConnectionsPerRoute
public int getMaxConnectionsPerRoute()
-