public static interface Host.StateListener
It is possible for the same event to be fired multiple times, particularly for up or down events. Therefore, a listener should ignore the same event if it has already been notified of a node's state.
Modifier and Type | Method and Description |
---|---|
void |
onAdd(Host host)
Called when a new node is added to the cluster.
|
void |
onDown(Host host)
Called when a node is determined to be down.
|
void |
onRemove(Host host)
Called when a node is removed from the cluster.
|
void |
onSuspected(Host host)
Called when a node is suspected to be dead.
|
void |
onUp(Host host)
Called when a node is determined to be up.
|
void onAdd(Host host)
The newly added node should be considered up.
host
- the host that has been newly added.void onUp(Host host)
host
- the host that has been detected up.void onSuspected(Host host)
A node is suspected to be dead when an error occurs on one of it's
opened connection. As soon as an host is suspected, a connection attempt
to that host is immediately tried. If this succeed, then it means that
the connection was disfunctional but that the node was not really down.
If this fails however, this means the node is truly dead, onDown() is
called and further reconnection attempts are scheduled according to the
ReconnectionPolicy
in place.
When this event is triggered, it is possible to call the host
Host.getInitialReconnectionAttemptFuture()
method to wait until the
initial and immediate reconnection attempt succeed or fail.
Note that some StateListener may ignore that event. If a node that
that is suspected down turns out to be truly down (that is, the driver
cannot successfully connect to it right away), then onDown(com.datastax.driver.core.Host)
will
be called.
void onDown(Host host)
host
- the host that has been detected down.void onRemove(Host host)
host
- the removed host.Copyright © 2014. All rights reserved.