org.apache.cassandra.gms

## Class FailureDetector

- java.lang.Object
- - org.apache.cassandra.gms.FailureDetector

All Implemented Interfaces:
  FailureDetectorMBean, IFailureDetector

    public class FailureDetector
    extends java.lang.Object
    implements IFailureDetector, FailureDetectorMBean

This FailureDetector is an implementation of the paper titled "The Phi Accrual Failure Detector" by Hayashibara. Check the paper and the IFailureDetector interface for details.

### Field Summary

Fields
`protected static long` `INITIAL_VALUE_NANOS`
`static IFailureDetector` `instance`
`static java.lang.String` `MBEAN_NAME`

### Constructor Summary

Constructors
Constructor and Description
`FailureDetector()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `dumpInterArrivalTimes()` Dump the inter arrival times for examination if necessary.
`void` `forceConviction(java.net.InetAddress ep)` force conviction of endpoint in the failure detector
`java.lang.String` `getAllEndpointStates()`
`int` `getDownEndpointCount()`
`java.lang.String` `getEndpointState(java.lang.String address)`
`double` `getPhiConvictThreshold()`
`javax.management.openmbean.TabularData` `getPhiValues()`
`java.util.Map<java.lang.String,java.lang.String>` `getSimpleStates()`
`int` `getUpEndpointCount()`
`void` `interpret(java.net.InetAddress ep)` This method is invoked by any entity wanting to interrogate the status of an endpoint.
`boolean` `isAlive(java.net.InetAddress ep)` Failure Detector's knowledge of whether a node is up or down.
`void` `registerFailureDetectionEventListener(IFailureDetectionEventListener listener)` Register interest for Failure Detector events.
`void` `remove(java.net.InetAddress ep)` remove endpoint from failure detector
`void` `report(java.net.InetAddress ep)` This method is invoked by the receiver of the heartbeat.
`void` `setPhiConvictThreshold(double phi)`
`java.lang.String` `toString()`
`void` `unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener)` Un-register interest for Failure Detector events.

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

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

### Field Detail

#### MBEAN_NAME

    public static final java.lang.String MBEAN_NAME

See Also:
  Constant Field Values

#### INITIAL_VALUE_NANOS

    protected static final long INITIAL_VALUE_NANOS

#### instance

    public static final IFailureDetector instance

### Constructor Detail

#### FailureDetector

    public FailureDetector()

### Method Detail

#### getAllEndpointStates

    public java.lang.String getAllEndpointStates()

Specified by:
  `getAllEndpointStates` in interface `FailureDetectorMBean`

#### getSimpleStates

    public java.util.Map<java.lang.String,java.lang.String> getSimpleStates()

Specified by:
  `getSimpleStates` in interface `FailureDetectorMBean`

#### getDownEndpointCount

    public int getDownEndpointCount()

Specified by:
  `getDownEndpointCount` in interface `FailureDetectorMBean`

#### getUpEndpointCount

    public int getUpEndpointCount()

Specified by:
  `getUpEndpointCount` in interface `FailureDetectorMBean`

#### getPhiValues

    public javax.management.openmbean.TabularData getPhiValues()
                                                        throws javax.management.openmbean.OpenDataException

Specified by:
  `getPhiValues` in interface `FailureDetectorMBean`
Throws:
  `javax.management.openmbean.OpenDataException`

#### getEndpointState

    public java.lang.String getEndpointState(java.lang.String address)
                                      throws java.net.UnknownHostException

Specified by:
  `getEndpointState` in interface `FailureDetectorMBean`
Throws:
  `java.net.UnknownHostException`

#### dumpInterArrivalTimes

    public void dumpInterArrivalTimes()

Dump the inter arrival times for examination if necessary.

Specified by:
  `dumpInterArrivalTimes` in interface `FailureDetectorMBean`

#### setPhiConvictThreshold

    public void setPhiConvictThreshold(double phi)

Specified by:
  `setPhiConvictThreshold` in interface `FailureDetectorMBean`

#### getPhiConvictThreshold

    public double getPhiConvictThreshold()

Specified by:
  `getPhiConvictThreshold` in interface `FailureDetectorMBean`

#### isAlive

    public boolean isAlive(java.net.InetAddress ep)

Description copied from interface: `IFailureDetector`
Failure Detector's knowledge of whether a node is up or down.

Specified by:
  `isAlive` in interface `IFailureDetector`
Parameters:
  `ep` - endpoint in question.
Returns:
  true if UP and false if DOWN.

#### report

    public void report(java.net.InetAddress ep)

Description copied from interface: `IFailureDetector`
This method is invoked by the receiver of the heartbeat. In our case it would be the Gossiper. Gossiper inform the Failure Detector on receipt of a heartbeat. The FailureDetector will then sample the arrival time as explained in the paper. param ep endpoint being reported.

Specified by:
  `report` in interface `IFailureDetector`

#### interpret

    public void interpret(java.net.InetAddress ep)

Description copied from interface: `IFailureDetector`
This method is invoked by any entity wanting to interrogate the status of an endpoint. In our case it would be the Gossiper. The Failure Detector will then calculate Phi and deem an endpoint as suspicious or alive as explained in the Hayashibara paper. param ep endpoint for which we interpret the inter arrival times.

Specified by:
  `interpret` in interface `IFailureDetector`

#### forceConviction

    public void forceConviction(java.net.InetAddress ep)

Description copied from interface: `IFailureDetector`
force conviction of endpoint in the failure detector

Specified by:
  `forceConviction` in interface `IFailureDetector`

#### remove

    public void remove(java.net.InetAddress ep)

Description copied from interface: `IFailureDetector`
remove endpoint from failure detector

Specified by:
  `remove` in interface `IFailureDetector`

#### registerFailureDetectionEventListener

    public void registerFailureDetectionEventListener(IFailureDetectionEventListener listener)

Description copied from interface: `IFailureDetector`
Register interest for Failure Detector events.

Specified by:
  `registerFailureDetectionEventListener` in interface `IFailureDetector`
Parameters:
  `listener` - implementation of an application provided IFailureDetectionEventListener

#### unregisterFailureDetectionEventListener

    public void unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener)

Description copied from interface: `IFailureDetector`
Un-register interest for Failure Detector events.

Specified by:
  `unregisterFailureDetectionEventListener` in interface `IFailureDetector`
Parameters:
  `listener` - implementation of an application provided IFailureDetectionEventListener

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`