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 and Description
    `ReconnectableSnitchHelper(IEndpointSnitch snitch, java.lang.String localDc, boolean preferLocal)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beforeChange(java.net.InetAddress endpoint, EndpointState currentState, ApplicationState newStateKey, VersionedValue newValue)`
    `void` | `onAlive(java.net.InetAddress endpoint, EndpointState state)`
    `void` | `onChange(java.net.InetAddress endpoint, ApplicationState state, VersionedValue value)`
    `void` | `onDead(java.net.InetAddress endpoint, EndpointState state)`
    `void` | `onJoin(java.net.InetAddress endpoint, EndpointState epState)` Use to inform interested parties about the change in the state for specified endpoint
    `void` | `onRemove(java.net.InetAddress endpoint)`
    `void` | `onRestart(java.net.InetAddress endpoint, EndpointState state)` Called whenever a node is restarted.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReconnectableSnitchHelper

          public ReconnectableSnitchHelper(IEndpointSnitch snitch,
                                           java.lang.String localDc,
                                           boolean preferLocal)

  - ### Method Detail

    - #### beforeChange

          public void beforeChange(java.net.InetAddress endpoint,
                                   EndpointState currentState,
                                   ApplicationState newStateKey,
                                   VersionedValue newValue)

      Specified by:
        `beforeChange` in interface `IEndpointStateChangeSubscriber`

    - #### onJoin

          public void onJoin(java.net.InetAddress 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 interface `IEndpointStateChangeSubscriber`
      Parameters:
        `endpoint` - endpoint for which the state change occurred.
        `epState` - state that actually changed for the above endpoint.

    - #### onChange

          public void onChange(java.net.InetAddress endpoint,
                               ApplicationState state,
                               VersionedValue value)

      Specified by:
        `onChange` in interface `IEndpointStateChangeSubscriber`

    - #### onAlive

          public void onAlive(java.net.InetAddress endpoint,
                              EndpointState state)

      Specified by:
        `onAlive` in interface `IEndpointStateChangeSubscriber`

    - #### onDead

          public void onDead(java.net.InetAddress endpoint,
                             EndpointState state)

      Specified by:
        `onDead` in interface `IEndpointStateChangeSubscriber`

    - #### onRemove

          public void onRemove(java.net.InetAddress endpoint)

      Specified by:
        `onRemove` in interface `IEndpointStateChangeSubscriber`

    - #### onRestart

          public void onRestart(java.net.InetAddress 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 if `state.isAlive() == false` as `state` is from before the restarted node is marked up.
      Specified by:
        `onRestart` in interface `IEndpointStateChangeSubscriber`

Copyright © 2018 The Apache Software Foundation