public class Sniffer
extends java.lang.Object
implements java.io.Closeable
RestClient. Must be created via SnifferBuilder, which allows to set all of the different options or rely on defaults.
A background task fetches the nodes through the HostsSniffer and sets them to the RestClient instance.
It is possible to perform sniffing on failure by creating a SniffOnFailureListener and providing it as an argument to
RestClientBuilder.setFailureListener(RestClient.FailureListener). The Sniffer implementation needs to be lazily set to the
previously created SniffOnFailureListener through SniffOnFailureListener.setSniffer(Sniffer).| Modifier and Type | Method and Description |
|---|---|
static SnifferBuilder |
builder(RestClient restClient)
Returns a new
SnifferBuilder to help with Sniffer creation. |
void |
close() |
void |
sniffOnFailure(org.apache.http.HttpHost failedHost)
Triggers a new sniffing round and explicitly takes out the failed host provided as argument
|
public void sniffOnFailure(org.apache.http.HttpHost failedHost)
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic static SnifferBuilder builder(RestClient restClient)
SnifferBuilder to help with Sniffer creation.restClient - the client that gets its hosts set (via RestClient.setHosts(HttpHost...)) once they are fetchedSnifferBuilder