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
FieldsFields inherited from class com.linkedin.venice.client.store.transport.TransportClient
HTTPS -
Constructor Summary
ConstructorsConstructorDescriptionHttpTransportClient(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.CloseableHttpAsyncClientbuildClient(String routerUrl, int maxConnectionsTotal, int maxConnectionsPerRoute, boolean requireHHtp2, SSLFactory sslFactory) Note: The callback that is triggered byCloseableHttpAsyncClientruns 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.voidclose()The sameCloseableHttpAsyncClientcould not be used to send out another request in its own callback function.intintNote: The callback that is triggered byCloseableHttpAsyncClientruns 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.voidstreamPost(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 byCloseableHttpAsyncClientruns 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 ofCompletableFutureif 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:
getin classTransportClient
-
post
public CompletableFuture<TransportClientResponse> post(String requestPath, Map<String, String> headers, byte[] requestBody) Note: The callback that is triggered byCloseableHttpAsyncClientruns 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 ofCompletableFutureif you plan to use the same client to make multiple requests sequentially.- Specified by:
postin 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 byCloseableHttpAsyncClientruns 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 ofCompletableFutureif you plan to use the same client to make multiple requests sequentially.- Specified by:
streamPostin classTransportClient
-
close
public void close() -
getCopyIfNotUsableInCallback
The sameCloseableHttpAsyncClientcould not be used to send out another request in its own callback function.- Overrides:
getCopyIfNotUsableInCallbackin classTransportClient- Returns:
-
toString
-
getMaxConnectionsTotal
public int getMaxConnectionsTotal() -
getMaxConnectionsPerRoute
public int getMaxConnectionsPerRoute()
-