Class ApacheHttpAsyncStorageNodeClient
java.lang.Object
com.linkedin.venice.router.httpclient.ApacheHttpAsyncStorageNodeClient
- All Implemented Interfaces:
StorageNodeClient,Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionApacheHttpAsyncStorageNodeClient(VeniceRouterConfig config, Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository, LiveInstanceMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the client and release all resources held by the clientorg.apache.http.impl.nio.client.CloseableHttpAsyncClientgetHttpClientForHost(String host) booleanisInstanceReadyToServe(String instanceId) voidquery(Instance host, VenicePath path, Consumer<PortableHttpResponse> completedCallBack, Consumer<Throwable> failedCallBack, BooleanSupplier cancelledCallBack) Send a request to storage nodevoidsendRequest(VeniceMetaDataRequest request, CompletableFuture<PortableHttpResponse> responseFuture) voidstart()Start the client and prepare the required resources.
-
Constructor Details
-
ApacheHttpAsyncStorageNodeClient
public ApacheHttpAsyncStorageNodeClient(VeniceRouterConfig config, Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository, LiveInstanceMonitor monitor)
-
-
Method Details
-
getHttpClientForHost
-
start
public void start()Description copied from interface:StorageNodeClientStart the client and prepare the required resources.- Specified by:
startin interfaceStorageNodeClient
-
isInstanceReadyToServe
- Specified by:
isInstanceReadyToServein interfaceStorageNodeClient
-
close
public void close()Description copied from interface:StorageNodeClientClose the client and release all resources held by the client- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceStorageNodeClient
-
sendRequest
public void sendRequest(VeniceMetaDataRequest request, CompletableFuture<PortableHttpResponse> responseFuture) - Specified by:
sendRequestin interfaceStorageNodeClient
-
query
public void query(Instance host, VenicePath path, Consumer<PortableHttpResponse> completedCallBack, Consumer<Throwable> failedCallBack, BooleanSupplier cancelledCallBack) throws RouterException Description copied from interface:StorageNodeClientSend a request to storage node- Specified by:
queryin interfaceStorageNodeClient- Parameters:
host- The target host to which the request will be sentpath- contains information like URI, request content, HTTP method, etc.completedCallBack- Callback function for a complete responsefailedCallBack- if any exception thrown in the channelcancelledCallBack- for requests that are cancelled by the channel- Throws:
RouterException
-