Package 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 Modifier and Type Field Description protected static longINITIAL_VALUE_NANOSstatic IFailureDetectorinstancestatic java.util.function.Predicate<InetAddressAndPort>isEndpointAlivestatic java.util.function.Predicate<Replica>isReplicaAlivestatic java.lang.StringMBEAN_NAME
-
Constructor Summary
Constructors Constructor Description FailureDetector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddumpInterArrivalTimes()Dump the inter arrival times for examination if necessary.voidforceConviction(InetAddressAndPort ep)force conviction of endpoint in the failure detectorjava.lang.StringgetAllEndpointStates()java.lang.StringgetAllEndpointStates(boolean withPort)java.lang.StringgetAllEndpointStates(boolean withPort, boolean resolveIp)java.lang.StringgetAllEndpointStatesWithPort()java.lang.StringgetAllEndpointStatesWithPortAndResolveIp()java.lang.StringgetAllEndpointStatesWithResolveIp()intgetDownEndpointCount()java.lang.StringgetEndpointState(java.lang.String address)doublegetPhiConvictThreshold()javax.management.openmbean.TabularDatagetPhiValues()javax.management.openmbean.TabularDatagetPhiValuesWithPort()java.util.Map<java.lang.String,java.lang.String>getSimpleStates()java.util.Map<java.lang.String,java.lang.String>getSimpleStatesWithPort()intgetUpEndpointCount()voidinterpret(InetAddressAndPort ep)This method is invoked by any entity wanting to interrogate the status of an endpoint.booleanisAlive(InetAddressAndPort ep)Failure Detector's knowledge of whether a node is up or down.voidregisterFailureDetectionEventListener(IFailureDetectionEventListener listener)Register interest for Failure Detector events.voidremove(InetAddressAndPort ep)remove endpoint from failure detectorvoidreport(InetAddressAndPort ep)This method is invoked by the receiver of the heartbeat.voidsetPhiConvictThreshold(double phi)java.lang.StringtoString()voidunregisterFailureDetectionEventListener(IFailureDetectionEventListener listener)Un-register interest for Failure Detector events.
-
-
-
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
-
isEndpointAlive
public static final java.util.function.Predicate<InetAddressAndPort> isEndpointAlive
-
isReplicaAlive
public static final java.util.function.Predicate<Replica> isReplicaAlive
-
-
Method Detail
-
getAllEndpointStates
public java.lang.String getAllEndpointStates()
- Specified by:
getAllEndpointStatesin interfaceFailureDetectorMBean
-
getAllEndpointStatesWithResolveIp
public java.lang.String getAllEndpointStatesWithResolveIp()
- Specified by:
getAllEndpointStatesWithResolveIpin interfaceFailureDetectorMBean
-
getAllEndpointStatesWithPort
public java.lang.String getAllEndpointStatesWithPort()
- Specified by:
getAllEndpointStatesWithPortin interfaceFailureDetectorMBean
-
getAllEndpointStatesWithPortAndResolveIp
public java.lang.String getAllEndpointStatesWithPortAndResolveIp()
- Specified by:
getAllEndpointStatesWithPortAndResolveIpin interfaceFailureDetectorMBean
-
getAllEndpointStates
public java.lang.String getAllEndpointStates(boolean withPort)
-
getAllEndpointStates
public java.lang.String getAllEndpointStates(boolean withPort, boolean resolveIp)
-
getSimpleStates
public java.util.Map<java.lang.String,java.lang.String> getSimpleStates()
- Specified by:
getSimpleStatesin interfaceFailureDetectorMBean
-
getSimpleStatesWithPort
public java.util.Map<java.lang.String,java.lang.String> getSimpleStatesWithPort()
- Specified by:
getSimpleStatesWithPortin interfaceFailureDetectorMBean
-
getDownEndpointCount
public int getDownEndpointCount()
- Specified by:
getDownEndpointCountin interfaceFailureDetectorMBean
-
getUpEndpointCount
public int getUpEndpointCount()
- Specified by:
getUpEndpointCountin interfaceFailureDetectorMBean
-
getPhiValues
public javax.management.openmbean.TabularData getPhiValues() throws javax.management.openmbean.OpenDataException- Specified by:
getPhiValuesin interfaceFailureDetectorMBean- Throws:
javax.management.openmbean.OpenDataException
-
getPhiValuesWithPort
public javax.management.openmbean.TabularData getPhiValuesWithPort() throws javax.management.openmbean.OpenDataException- Specified by:
getPhiValuesWithPortin interfaceFailureDetectorMBean- Throws:
javax.management.openmbean.OpenDataException
-
getEndpointState
public java.lang.String getEndpointState(java.lang.String address) throws java.net.UnknownHostException- Specified by:
getEndpointStatein interfaceFailureDetectorMBean- Throws:
java.net.UnknownHostException
-
dumpInterArrivalTimes
public void dumpInterArrivalTimes()
Dump the inter arrival times for examination if necessary.- Specified by:
dumpInterArrivalTimesin interfaceFailureDetectorMBean
-
setPhiConvictThreshold
public void setPhiConvictThreshold(double phi)
- Specified by:
setPhiConvictThresholdin interfaceFailureDetectorMBean
-
getPhiConvictThreshold
public double getPhiConvictThreshold()
- Specified by:
getPhiConvictThresholdin interfaceFailureDetectorMBean
-
isAlive
public boolean isAlive(InetAddressAndPort ep)
Description copied from interface:IFailureDetectorFailure Detector's knowledge of whether a node is up or down.- Specified by:
isAlivein interfaceIFailureDetector- Parameters:
ep- endpoint in question.- Returns:
- true if UP and false if DOWN.
-
report
public void report(InetAddressAndPort ep)
Description copied from interface:IFailureDetectorThis 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:
reportin interfaceIFailureDetector
-
interpret
public void interpret(InetAddressAndPort ep)
Description copied from interface:IFailureDetectorThis 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:
interpretin interfaceIFailureDetector
-
forceConviction
public void forceConviction(InetAddressAndPort ep)
Description copied from interface:IFailureDetectorforce conviction of endpoint in the failure detector- Specified by:
forceConvictionin interfaceIFailureDetector
-
remove
public void remove(InetAddressAndPort ep)
Description copied from interface:IFailureDetectorremove endpoint from failure detector- Specified by:
removein interfaceIFailureDetector
-
registerFailureDetectionEventListener
public void registerFailureDetectionEventListener(IFailureDetectionEventListener listener)
Description copied from interface:IFailureDetectorRegister interest for Failure Detector events.- Specified by:
registerFailureDetectionEventListenerin interfaceIFailureDetector- Parameters:
listener- implementation of an application provided IFailureDetectionEventListener
-
unregisterFailureDetectionEventListener
public void unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener)
Description copied from interface:IFailureDetectorUn-register interest for Failure Detector events.- Specified by:
unregisterFailureDetectionEventListenerin interfaceIFailureDetector- Parameters:
listener- implementation of an application provided IFailureDetectionEventListener
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-