Class DefaultConfigParamsImpl
- java.lang.Object
-
- org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl
-
- All Implemented Interfaces:
ConfigParams
public class DefaultConfigParamsImpl extends Object implements ConfigParams
Default implementation of the ConfigParams.
-
-
Field Summary
Fields Modifier and Type Field Description static scala.concurrent.duration.FiniteDuration
HEART_BEAT_INTERVAL
The interval at which a heart beat message will be sent to the remote RaftActor.-
Fields inherited from interface org.opendaylight.controller.cluster.raft.ConfigParams
MEGABYTE
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigParamsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCandidateElectionTimeoutDivisor()
Returns the number by which a candidate should divide the election timeout it has calculated.String
getCustomRaftPolicyImplementationClass()
Returns the custom RaftPolicy class name.long
getElectionTimeoutFactor()
Returns the multiplication factor to be used to determine the shard election timeout.scala.concurrent.duration.FiniteDuration
getElectionTimeOutInterval()
Returns the interval after which a new election should be triggered if no leader is available.int
getElectionTimeVariance()
Returns the maximum election time variance.int
getFileBackedStreamingThreshold()
Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in memory to buffering to a file.scala.concurrent.duration.FiniteDuration
getHeartBeatInterval()
Returns the interval at which a heart beat message should be sent to remote followers.long
getIsolatedCheckIntervalInMillis()
Returns the interval in which the leader needs to check if its isolated.int
getJournalRecoveryLogBatchSize()
Returns the maximum number of journal log entries to batch on recovery before applying.PeerAddressResolver
getPeerAddressResolver()
Returns the PeerAddressResolver.RaftPolicy
getRaftPolicy()
Returns the RaftPolicy used to determine certain Raft behaviors.long
getSnapshotBatchCount()
Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.int
getSnapshotChunkSize()
Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.int
getSnapshotDataThresholdPercentage()
Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.long
getSyncIndexThreshold()
Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.String
getTempFileDirectory()
Returns the directory in which to create temp files.void
setCandidateElectionTimeoutDivisor(long candidateElectionTimeoutDivisor)
void
setCustomRaftPolicyImplementationClass(String customRaftPolicyImplementationClass)
void
setElectionTimeoutFactor(long electionTimeoutFactor)
void
setFileBackedStreamingThreshold(int fileBackedStreamingThreshold)
void
setHeartBeatInterval(scala.concurrent.duration.FiniteDuration heartBeatInterval)
void
setIsolatedLeaderCheckInterval(scala.concurrent.duration.FiniteDuration isolatedLeaderCheckInterval)
void
setJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize)
void
setPeerAddressResolver(@NonNull PeerAddressResolver peerAddressResolver)
void
setSnapshotBatchCount(long snapshotBatchCount)
void
setSnapshotChunkSize(int snapshotChunkSize)
void
setSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage)
void
setSyncIndexThreshold(long syncIndexThreshold)
void
setTempFileDirectory(String tempFileDirectory)
-
-
-
Method Detail
-
setHeartBeatInterval
public void setHeartBeatInterval(scala.concurrent.duration.FiniteDuration heartBeatInterval)
-
setSnapshotBatchCount
public void setSnapshotBatchCount(long snapshotBatchCount)
-
setSnapshotDataThresholdPercentage
public void setSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage)
-
setSnapshotChunkSize
public void setSnapshotChunkSize(int snapshotChunkSize)
-
setJournalRecoveryLogBatchSize
public void setJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize)
-
setIsolatedLeaderCheckInterval
public void setIsolatedLeaderCheckInterval(scala.concurrent.duration.FiniteDuration isolatedLeaderCheckInterval)
-
setElectionTimeoutFactor
public void setElectionTimeoutFactor(long electionTimeoutFactor)
-
setCandidateElectionTimeoutDivisor
public void setCandidateElectionTimeoutDivisor(long candidateElectionTimeoutDivisor)
-
setTempFileDirectory
public void setTempFileDirectory(String tempFileDirectory)
-
setFileBackedStreamingThreshold
public void setFileBackedStreamingThreshold(int fileBackedStreamingThreshold)
-
setCustomRaftPolicyImplementationClass
public void setCustomRaftPolicyImplementationClass(String customRaftPolicyImplementationClass)
-
getCustomRaftPolicyImplementationClass
public String getCustomRaftPolicyImplementationClass()
Description copied from interface:ConfigParams
Returns the custom RaftPolicy class name.- Specified by:
getCustomRaftPolicyImplementationClass
in interfaceConfigParams
- Returns:
- the RaftPolicy class name or null if none set.
-
getSnapshotBatchCount
public long getSnapshotBatchCount()
Description copied from interface:ConfigParams
Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.- Specified by:
getSnapshotBatchCount
in interfaceConfigParams
- Returns:
- the minimum number of entries.
-
getSnapshotDataThresholdPercentage
public int getSnapshotDataThresholdPercentage()
Description copied from interface:ConfigParams
Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.- Specified by:
getSnapshotDataThresholdPercentage
in interfaceConfigParams
- Returns:
- the percentage.
-
getHeartBeatInterval
public scala.concurrent.duration.FiniteDuration getHeartBeatInterval()
Description copied from interface:ConfigParams
Returns the interval at which a heart beat message should be sent to remote followers.- Specified by:
getHeartBeatInterval
in interfaceConfigParams
- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeOutInterval
public scala.concurrent.duration.FiniteDuration getElectionTimeOutInterval()
Description copied from interface:ConfigParams
Returns the interval after which a new election should be triggered if no leader is available.- Specified by:
getElectionTimeOutInterval
in interfaceConfigParams
- Returns:
- the interval as a FiniteDuration.
-
getCandidateElectionTimeoutDivisor
public long getCandidateElectionTimeoutDivisor()
Description copied from interface:ConfigParams
Returns the number by which a candidate should divide the election timeout it has calculated. This serves to speed up retries when elections result in a stalemate.- Specified by:
getCandidateElectionTimeoutDivisor
in interfaceConfigParams
- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeVariance
public int getElectionTimeVariance()
Description copied from interface:ConfigParams
Returns the maximum election time variance. The election is scheduled using both the election timeout and variance.- Specified by:
getElectionTimeVariance
in interfaceConfigParams
- Returns:
- the election time variance.
-
getSnapshotChunkSize
public int getSnapshotChunkSize()
Description copied from interface:ConfigParams
Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.- Specified by:
getSnapshotChunkSize
in interfaceConfigParams
- Returns:
- the maximum size (in bytes).
-
getJournalRecoveryLogBatchSize
public int getJournalRecoveryLogBatchSize()
Description copied from interface:ConfigParams
Returns the maximum number of journal log entries to batch on recovery before applying.- Specified by:
getJournalRecoveryLogBatchSize
in interfaceConfigParams
- Returns:
- the maximum number of journal log entries.
-
getIsolatedCheckIntervalInMillis
public long getIsolatedCheckIntervalInMillis()
Description copied from interface:ConfigParams
Returns the interval in which the leader needs to check if its isolated.- Specified by:
getIsolatedCheckIntervalInMillis
in interfaceConfigParams
- Returns:
- the interval in ms.
-
getElectionTimeoutFactor
public long getElectionTimeoutFactor()
Description copied from interface:ConfigParams
Returns the multiplication factor to be used to determine the shard election timeout. The election timeout is determined by multiplying the election timeout factor with the heart beat duration.- Specified by:
getElectionTimeoutFactor
in interfaceConfigParams
- Returns:
- the election timeout factor.
-
getRaftPolicy
public RaftPolicy getRaftPolicy()
Description copied from interface:ConfigParams
Returns the RaftPolicy used to determine certain Raft behaviors.- Specified by:
getRaftPolicy
in interfaceConfigParams
- Returns:
- an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
-
getTempFileDirectory
public String getTempFileDirectory()
Description copied from interface:ConfigParams
Returns the directory in which to create temp files.- Specified by:
getTempFileDirectory
in interfaceConfigParams
- Returns:
- the directory in which to create temp files.
-
getFileBackedStreamingThreshold
public int getFileBackedStreamingThreshold()
Description copied from interface:ConfigParams
Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in memory to buffering to a file.- Specified by:
getFileBackedStreamingThreshold
in interfaceConfigParams
- Returns:
- the threshold in terms of number of bytes.
-
getPeerAddressResolver
public PeerAddressResolver getPeerAddressResolver()
Description copied from interface:ConfigParams
Returns the PeerAddressResolver.- Specified by:
getPeerAddressResolver
in interfaceConfigParams
- Returns:
- the PeerAddressResolver instance.
-
setPeerAddressResolver
public void setPeerAddressResolver(@NonNull PeerAddressResolver peerAddressResolver)
-
getSyncIndexThreshold
public long getSyncIndexThreshold()
Description copied from interface:ConfigParams
Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.- Specified by:
getSyncIndexThreshold
in interfaceConfigParams
- Returns:
- the threshold in terms of number of journal entries.
-
setSyncIndexThreshold
public void setSyncIndexThreshold(long syncIndexThreshold)
-
-