Class ApacheHttpAsyncStorageNodeClient
- java.lang.Object
-
- com.linkedin.venice.router.httpclient.ApacheHttpAsyncStorageNodeClient
-
- All Implemented Interfaces:
StorageNodeClient
,java.io.Closeable
,java.lang.AutoCloseable
public class ApacheHttpAsyncStorageNodeClient extends java.lang.Object implements StorageNodeClient
-
-
Constructor Summary
Constructors Constructor Description ApacheHttpAsyncStorageNodeClient(VeniceRouterConfig config, java.util.Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository, LiveInstanceMonitor monitor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the client and release all resources held by the clientorg.apache.http.impl.nio.client.CloseableHttpAsyncClient
getHttpClientForHost(java.lang.String host)
boolean
isInstanceReadyToServe(java.lang.String instanceId)
void
query(Instance host, VenicePath path, java.util.function.Consumer<PortableHttpResponse> completedCallBack, java.util.function.Consumer<java.lang.Throwable> failedCallBack, java.util.function.BooleanSupplier cancelledCallBack)
Send a request to storage nodevoid
sendRequest(VeniceMetaDataRequest request, java.util.concurrent.CompletableFuture<PortableHttpResponse> responseFuture)
void
start()
Start the client and prepare the required resources.
-
-
-
Constructor Detail
-
ApacheHttpAsyncStorageNodeClient
public ApacheHttpAsyncStorageNodeClient(VeniceRouterConfig config, java.util.Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository, LiveInstanceMonitor monitor)
-
-
Method Detail
-
getHttpClientForHost
public org.apache.http.impl.nio.client.CloseableHttpAsyncClient getHttpClientForHost(java.lang.String host)
-
start
public void start()
Description copied from interface:StorageNodeClient
Start the client and prepare the required resources.- Specified by:
start
in interfaceStorageNodeClient
-
isInstanceReadyToServe
public boolean isInstanceReadyToServe(java.lang.String instanceId)
- Specified by:
isInstanceReadyToServe
in interfaceStorageNodeClient
-
close
public void close()
Description copied from interface:StorageNodeClient
Close the client and release all resources held by the client- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceStorageNodeClient
-
sendRequest
public void sendRequest(VeniceMetaDataRequest request, java.util.concurrent.CompletableFuture<PortableHttpResponse> responseFuture)
- Specified by:
sendRequest
in interfaceStorageNodeClient
-
query
public void query(Instance host, VenicePath path, java.util.function.Consumer<PortableHttpResponse> completedCallBack, java.util.function.Consumer<java.lang.Throwable> failedCallBack, java.util.function.BooleanSupplier cancelledCallBack) throws RouterException
Description copied from interface:StorageNodeClient
Send a request to storage node- Specified by:
query
in 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
-
-