Package org.apache.druid.discovery
Class DruidLeaderClient
java.lang.Object
org.apache.druid.discovery.DruidLeaderClient
This class facilitates interaction with Coordinator/Overlord leader nodes. Instance of this class is injected
via Guice with annotations @Coordinator or @IndexingService .
Usage:
Request request = druidLeaderClient.makeRequest(HttpMethod, requestPath)
request.setXXX(..)
FullResponseHolder responseHolder = druidLeaderClient.go(request)
-
Constructor Summary
ConstructorsConstructorDescriptionDruidLeaderClient(HttpClient httpClient, DruidNodeDiscoveryProvider druidNodeDiscoveryProvider, NodeRole nodeRoleToWatch, String leaderRequestPath) -
Method Summary
Modifier and TypeMethodDescriptionExecutes a Request object aimed at the leader.<T,H extends FullResponseHolder<T>>
Hgo(Request request, HttpResponseHandler<H, H> responseHandler) Executes a Request object aimed at the leader.makeRequest(org.jboss.netty.handler.codec.http.HttpMethod httpMethod, String urlPath) Make a Request object aimed at the leader.voidstart()voidstop()
-
Constructor Details
-
DruidLeaderClient
public DruidLeaderClient(HttpClient httpClient, DruidNodeDiscoveryProvider druidNodeDiscoveryProvider, NodeRole nodeRoleToWatch, String leaderRequestPath)
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
makeRequest
public Request makeRequest(org.jboss.netty.handler.codec.http.HttpMethod httpMethod, String urlPath) throws IOException Make a Request object aimed at the leader. Throws IOException if the leader cannot be located.- Throws:
IOException
-
go
Executes a Request object aimed at the leader. Throws IOException if the leader cannot be located. Internal retries with cache invalidation are attempted if 503/504 response is received.- Parameters:
request-- Throws:
IOExceptionInterruptedException
-
go
public <T,H extends FullResponseHolder<T>> H go(Request request, HttpResponseHandler<H, H> responseHandler) throws IOException, InterruptedExceptionExecutes a Request object aimed at the leader. Throws IOException if the leader cannot be located. Internal retries with cache invalidation are attempted if 503/504 response is received.- Parameters:
request-responseHandler-- Throws:
IOExceptionInterruptedException
-
findCurrentLeader
-