Package org.apache.cassandra.locator
Class ReconnectableSnitchHelper
- java.lang.Object
-
- org.apache.cassandra.locator.ReconnectableSnitchHelper
-
- All Implemented Interfaces:
IEndpointStateChangeSubscriber
public class ReconnectableSnitchHelper extends java.lang.Object implements IEndpointStateChangeSubscriber
Sidekick helper for snitches that want to reconnect from one IP addr for a node to another. Typically, this is for situations like EC2 where a node will have a public address and a private address, where we connect on the public, discover the private, and reconnect on the private.
-
-
Constructor Summary
Constructors Constructor Description ReconnectableSnitchHelper(IEndpointSnitch snitch, java.lang.String localDc, boolean preferLocal)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeChange(InetAddressAndPort endpoint, EndpointState currentState, ApplicationState newStateKey, VersionedValue newValue)
void
onAlive(InetAddressAndPort endpoint, EndpointState state)
void
onChange(InetAddressAndPort endpoint, ApplicationState state, VersionedValue value)
void
onDead(InetAddressAndPort endpoint, EndpointState state)
void
onJoin(InetAddressAndPort endpoint, EndpointState epState)
Use to inform interested parties about the change in the state for specified endpointvoid
onRemove(InetAddressAndPort endpoint)
void
onRestart(InetAddressAndPort endpoint, EndpointState state)
Called whenever a node is restarted.
-
-
-
Constructor Detail
-
ReconnectableSnitchHelper
public ReconnectableSnitchHelper(IEndpointSnitch snitch, java.lang.String localDc, boolean preferLocal)
-
-
Method Detail
-
beforeChange
public void beforeChange(InetAddressAndPort endpoint, EndpointState currentState, ApplicationState newStateKey, VersionedValue newValue)
- Specified by:
beforeChange
in interfaceIEndpointStateChangeSubscriber
-
onJoin
public void onJoin(InetAddressAndPort endpoint, EndpointState epState)
Description copied from interface:IEndpointStateChangeSubscriber
Use to inform interested parties about the change in the state for specified endpoint- Specified by:
onJoin
in interfaceIEndpointStateChangeSubscriber
- Parameters:
endpoint
- endpoint for which the state change occurred.epState
- state that actually changed for the above endpoint.
-
onChange
public void onChange(InetAddressAndPort endpoint, ApplicationState state, VersionedValue value)
- Specified by:
onChange
in interfaceIEndpointStateChangeSubscriber
-
onAlive
public void onAlive(InetAddressAndPort endpoint, EndpointState state)
- Specified by:
onAlive
in interfaceIEndpointStateChangeSubscriber
-
onDead
public void onDead(InetAddressAndPort endpoint, EndpointState state)
- Specified by:
onDead
in interfaceIEndpointStateChangeSubscriber
-
onRemove
public void onRemove(InetAddressAndPort endpoint)
- Specified by:
onRemove
in interfaceIEndpointStateChangeSubscriber
-
onRestart
public void onRestart(InetAddressAndPort endpoint, EndpointState state)
Description copied from interface:IEndpointStateChangeSubscriber
Called whenever a node is restarted. Note that there is no guarantee when that happens that the node was previously marked down. It will have only ifstate.isAlive() == false
asstate
is from before the restarted node is marked up.- Specified by:
onRestart
in interfaceIEndpointStateChangeSubscriber
-
-