Package io.hekate.cluster.health
Class DefaultFailureDetectorConfig
- java.lang.Object
-
- io.hekate.cluster.health.DefaultFailureDetectorConfig
-
public class DefaultFailureDetectorConfig extends Object
Configuration forDefaultFailureDetector
.- See Also:
DefaultFailureDetector
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_FAILURE_DETECTION_QUORUM
Default value (=2) forsetFailureDetectionQuorum(int)
.static int
DEFAULT_HEARTBEAT_INTERVAL
Default value (=500) forsetHeartbeatInterval(long)
.static int
DEFAULT_HEARTBEAT_LOSS_THRESHOLD
Default value (=6) forsetHeartbeatLossThreshold(int)
.
-
Constructor Summary
Constructors Constructor Description DefaultFailureDetectorConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getFailureDetectionQuorum()
Returns the amount of nodes that should agree on some particular node failure before removing such a suspected node from the cluster (seesetFailureDetectionQuorum(int)
).long
getHeartbeatInterval()
Returns the heartbeat sending interval in milliseconds (seesetHeartbeatInterval(long)
).int
getHeartbeatLossThreshold()
Returns the amount of heartbeats that can be lost before considering a node failure (seesetHeartbeatLossThreshold(int)
).boolean
isFailFast()
Sets the flag that controls the failure detection behavior in case of network connectivity issues between the cluster nodes (seesetFailFast(boolean)
.void
setFailFast(boolean failFast)
Sets the flag that controls the failure detection behavior in case of network connectivity issues between the cluster nodes.void
setFailureDetectionQuorum(int failureDetectionQuorum)
Sets the amount of nodes that should agree on some particular node failure before removing such a suspected node from the cluster.void
setHeartbeatInterval(long heartbeatInterval)
Sets the heartbeat sending interval in milliseconds.void
setHeartbeatLossThreshold(int heartbeatLossThreshold)
Sets the amount of heartbeats that can be lost before considering a node failure.String
toString()
DefaultFailureDetectorConfig
withFailFast(boolean failFast)
Fluent-style version ofsetFailFast(boolean)
.DefaultFailureDetectorConfig
withFailureDetectionQuorum(int failureDetectionQuorum)
Fluent-style version ofsetFailureDetectionQuorum(int)
.DefaultFailureDetectorConfig
withHeartbeatInterval(long heartbeatInterval)
Fluent-style version ofsetHeartbeatInterval(long)
.DefaultFailureDetectorConfig
withHeartbeatLossThreshold(int heartbeatLossThreshold)
Fluent-style version ofsetHeartbeatLossThreshold(int)
.
-
-
-
Field Detail
-
DEFAULT_HEARTBEAT_INTERVAL
public static final int DEFAULT_HEARTBEAT_INTERVAL
Default value (=500) forsetHeartbeatInterval(long)
.- See Also:
- Constant Field Values
-
DEFAULT_HEARTBEAT_LOSS_THRESHOLD
public static final int DEFAULT_HEARTBEAT_LOSS_THRESHOLD
Default value (=6) forsetHeartbeatLossThreshold(int)
.- See Also:
- Constant Field Values
-
DEFAULT_FAILURE_DETECTION_QUORUM
public static final int DEFAULT_FAILURE_DETECTION_QUORUM
Default value (=2) forsetFailureDetectionQuorum(int)
.- See Also:
- Constant Field Values
-
-
Method Detail
-
getHeartbeatInterval
public long getHeartbeatInterval()
Returns the heartbeat sending interval in milliseconds (seesetHeartbeatInterval(long)
).- Returns:
- Time interval in milliseconds.
-
setHeartbeatInterval
public void setHeartbeatInterval(long heartbeatInterval)
Sets the heartbeat sending interval in milliseconds.Value of this parameter must be above zero. Default value is 500.
- Parameters:
heartbeatInterval
- Time interval in milliseconds.
-
withHeartbeatInterval
public DefaultFailureDetectorConfig withHeartbeatInterval(long heartbeatInterval)
Fluent-style version ofsetHeartbeatInterval(long)
.- Parameters:
heartbeatInterval
- Time interval in milliseconds.- Returns:
- This instance.
-
getHeartbeatLossThreshold
public int getHeartbeatLossThreshold()
Returns the amount of heartbeats that can be lost before considering a node failure (seesetHeartbeatLossThreshold(int)
).- Returns:
- Heartbeat loss threshold.
-
setHeartbeatLossThreshold
public void setHeartbeatLossThreshold(int heartbeatLossThreshold)
Sets the amount of heartbeats that can be lost before considering a node failure.Value of this parameter must be above zero. Default value is 6.
- Parameters:
heartbeatLossThreshold
- Heartbeat loss threshold.
-
withHeartbeatLossThreshold
public DefaultFailureDetectorConfig withHeartbeatLossThreshold(int heartbeatLossThreshold)
Fluent-style version ofsetHeartbeatLossThreshold(int)
.- Parameters:
heartbeatLossThreshold
- Heartbeat loss threshold.- Returns:
- This instance.
-
getFailureDetectionQuorum
public int getFailureDetectionQuorum()
Returns the amount of nodes that should agree on some particular node failure before removing such a suspected node from the cluster (seesetFailureDetectionQuorum(int)
).- Returns:
- Amount of nodes that should agree on some particular node failure before removing such a suspected node from the cluster.
-
setFailureDetectionQuorum
public void setFailureDetectionQuorum(int failureDetectionQuorum)
Sets the amount of nodes that should agree on some particular node failure before removing such a suspected node from the cluster.Value of this parameter must be above 1. Default value is 2.
- Parameters:
failureDetectionQuorum
- Amount of nodes that should agree on some particular node failure before removing such suspected node from the cluster.- See Also:
FailureDetector.failureQuorum()
-
withFailureDetectionQuorum
public DefaultFailureDetectorConfig withFailureDetectionQuorum(int failureDetectionQuorum)
Fluent-style version ofsetFailureDetectionQuorum(int)
.- Parameters:
failureDetectionQuorum
- Amount of nodes that should agree on some particular node failure before removing such suspected node from the cluster.- Returns:
- This instance.
-
isFailFast
public boolean isFailFast()
Sets the flag that controls the failure detection behavior in case of network connectivity issues between the cluster nodes (seesetFailFast(boolean)
.- Returns:
true
if fast-fail failure detection mode is enabled.
-
setFailFast
public void setFailFast(boolean failFast)
Sets the flag that controls the failure detection behavior in case of network connectivity issues between the cluster nodes.If this flag is set to
true
then cluster node will be immediately treated as failed in case of aConnectException
while sending a gossip message to that node. If set tofalse
then failure detector will wait for allsetHeartbeatLossThreshold(int)
attempts before treating such a node as failed.Default value of this parameter is
true
.- Parameters:
failFast
-true
to speed up failure detection.
-
withFailFast
public DefaultFailureDetectorConfig withFailFast(boolean failFast)
Fluent-style version ofsetFailFast(boolean)
.- Parameters:
failFast
-true
to speed up failure detection.- Returns:
- This instance.
-
-