public class DruidLeaderClient extends Object
| Constructor and Description |
|---|
DruidLeaderClient(HttpClient httpClient,
DruidNodeDiscoveryProvider druidNodeDiscoveryProvider,
NodeRole nodeRoleToWatch,
String leaderRequestPath,
DiscoverySelector<Server> serverDiscoverySelector) |
| Modifier and Type | Method and Description |
|---|---|
String |
findCurrentLeader() |
StringFullResponseHolder |
go(Request request) |
<T,H extends FullResponseHolder<T>> |
go(Request request,
HttpResponseHandler<H,H> responseHandler)
Executes a Request object aimed at the leader.
|
<Intermediate,Final> |
goAsync(Request request,
HttpResponseHandler<Intermediate,Final> handler)
Executes the request object aimed at the leader and process the response with given handler
Note: this method doesn't do retrying on errors or handle leader changes occurred during communication
|
Request |
makeRequest(org.jboss.netty.handler.codec.http.HttpMethod httpMethod,
String urlPath)
Make a Request object aimed at the leader.
|
Request |
makeRequest(org.jboss.netty.handler.codec.http.HttpMethod httpMethod,
String urlPath,
boolean cached)
Make a Request object aimed at the leader.
|
void |
start() |
void |
stop() |
public DruidLeaderClient(HttpClient httpClient, DruidNodeDiscoveryProvider druidNodeDiscoveryProvider, NodeRole nodeRoleToWatch, String leaderRequestPath, DiscoverySelector<Server> serverDiscoverySelector)
public void start()
public void stop()
public Request makeRequest(org.jboss.netty.handler.codec.http.HttpMethod httpMethod, String urlPath, boolean cached) throws IOException
cached - Uses cached leader if true, else uses the current leaderIOExceptionpublic Request makeRequest(org.jboss.netty.handler.codec.http.HttpMethod httpMethod, String urlPath) throws IOException
IOExceptionpublic StringFullResponseHolder go(Request request) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic <Intermediate,Final> com.google.common.util.concurrent.ListenableFuture<Final> goAsync(Request request, HttpResponseHandler<Intermediate,Final> handler)
public <T,H extends FullResponseHolder<T>> H go(Request request, HttpResponseHandler<H,H> responseHandler) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic String findCurrentLeader()
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.