Package org.opensearch.client.sniff
Class SniffOnFailureListener
java.lang.Object
org.opensearch.client.RestClient.FailureListener
org.opensearch.client.sniff.SniffOnFailureListener
public class SniffOnFailureListener
extends org.opensearch.client.RestClient.FailureListener
RestClient.FailureListener implementation that allows to perform
sniffing on failure. Gets notified whenever a failure happens and uses a Sniffer instance
to manually reload hosts and sets them back to the RestClient. The Sniffer instance
needs to be lazily set through setSniffer(Sniffer).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonFailure(org.opensearch.client.Node node) voidsetSniffer(Sniffer sniffer) Sets theSnifferinstance used to perform sniffing.
-
Constructor Details
-
SniffOnFailureListener
public SniffOnFailureListener()Creates aSniffOnFailureListenerinstance. TheSnifferneeds to be set throughsetSniffer(Sniffer)after instantiation.
-
-
Method Details
-
setSniffer
Sets theSnifferinstance used to perform sniffing.- Parameters:
sniffer- TheSnifferinstance to be used.- Throws:
IllegalStateException- if the sniffer was already set, as it can only be set once
-
onFailure
public void onFailure(org.opensearch.client.Node node) - Overrides:
onFailurein classorg.opensearch.client.RestClient.FailureListener
-