Package org.elasticsearch.client.sniff
Class SnifferBuilder
- java.lang.Object
-
- org.elasticsearch.client.sniff.SnifferBuilder
-
public final class SnifferBuilder extends java.lang.Object
Sniffer builder. Helps creating a newSniffer
.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_SNIFF_AFTER_FAILURE_DELAY
static long
DEFAULT_SNIFF_INTERVAL
-
Method Summary
Modifier and Type Method Description Sniffer
build()
Creates theSniffer
based on the provided configuration.SnifferBuilder
setNodesSniffer(NodesSniffer nodesSniffer)
Sets theNodesSniffer
to be used to read hosts.SnifferBuilder
setSniffAfterFailureDelayMillis(int sniffAfterFailureDelayMillis)
Sets the delay of a sniff execution scheduled after a failure (in milliseconds)SnifferBuilder
setSniffIntervalMillis(int sniffIntervalMillis)
Sets the interval between consecutive ordinary sniff executions in milliseconds.
-
-
-
Method Detail
-
setSniffIntervalMillis
public SnifferBuilder setSniffIntervalMillis(int sniffIntervalMillis)
Sets the interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions.- Throws:
java.lang.IllegalArgumentException
- if sniffIntervalMillis is not greater than 0
-
setSniffAfterFailureDelayMillis
public SnifferBuilder setSniffAfterFailureDelayMillis(int sniffAfterFailureDelayMillis)
Sets the delay of a sniff execution scheduled after a failure (in milliseconds)
-
setNodesSniffer
public SnifferBuilder setNodesSniffer(NodesSniffer nodesSniffer)
Sets theNodesSniffer
to be used to read hosts. A default instance ofElasticsearchNodesSniffer
is created when not provided. This method can be used to change the configuration of theElasticsearchNodesSniffer
, or to provide a different implementation (e.g. in case hosts need to taken from a different source).
-
-