Class HttpTransportClient
- java.lang.Object
-
- com.linkedin.venice.client.store.transport.TransportClient
-
- com.linkedin.venice.client.store.transport.HttpTransportClient
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
HttpsTransportClient
public class HttpTransportClient extends TransportClient
CloseableHttpAsyncClient
based TransportClient implementation.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
maxConnectionsPerRoute
protected int
maxConnectionsTotal
protected java.lang.String
routerUrl
-
Fields inherited from class com.linkedin.venice.client.store.transport.TransportClient
HTTPS
-
-
Constructor Summary
Constructors Constructor Description HttpTransportClient(java.lang.String routerUrl, int maxConnectionsTotal, int maxConnectionsPerRoute)
HttpTransportClient(java.lang.String routerUrl, org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient httpClient)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient
buildClient(java.lang.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()
java.util.concurrent.CompletableFuture<TransportClientResponse>
get(java.lang.String requestPath, java.util.Map<java.lang.String,java.lang.String> headers)
TransportClient
getCopyIfNotUsableInCallback()
The sameCloseableHttpAsyncClient
could not be used to send out another request in its own callback function.int
getMaxConnectionsPerRoute()
int
getMaxConnectionsTotal()
java.util.concurrent.CompletableFuture<TransportClientResponse>
post(java.lang.String requestPath, java.util.Map<java.lang.String,java.lang.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.void
streamPost(java.lang.String requestPath, java.util.Map<java.lang.String,java.lang.String> headers, byte[] requestBody, TransportClientStreamingCallback callback, int keyCount)
Leverage non-streaming post to achieve feature parity.java.lang.String
toString()
-
Methods inherited from class com.linkedin.venice.client.store.transport.TransportClient
get, post
-
-
-
-
Method Detail
-
buildClient
protected static org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient buildClient(java.lang.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 java.util.concurrent.CompletableFuture<TransportClientResponse> get(java.lang.String requestPath, java.util.Map<java.lang.String,java.lang.String> headers)
- Specified by:
get
in classTransportClient
-
post
public java.util.concurrent.CompletableFuture<TransportClientResponse> post(java.lang.String requestPath, java.util.Map<java.lang.String,java.lang.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(java.lang.String requestPath, java.util.Map<java.lang.String,java.lang.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
public TransportClient getCopyIfNotUsableInCallback()
The sameCloseableHttpAsyncClient
could not be used to send out another request in its own callback function.- Overrides:
getCopyIfNotUsableInCallback
in classTransportClient
- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getMaxConnectionsTotal
public int getMaxConnectionsTotal()
-
getMaxConnectionsPerRoute
public int getMaxConnectionsPerRoute()
-
-