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.FiniteDurationHEART_BEAT_INTERVALThe 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 longgetCandidateElectionTimeoutDivisor()Returns the number by which a candidate should divide the election timeout it has calculated.StringgetCustomRaftPolicyImplementationClass()Returns the custom RaftPolicy class name.longgetElectionTimeoutFactor()Returns the multiplication factor to be used to determine the shard election timeout.scala.concurrent.duration.FiniteDurationgetElectionTimeOutInterval()Returns the interval after which a new election should be triggered if no leader is available.intgetElectionTimeVariance()Returns the maximum election time variance.intgetFileBackedStreamingThreshold()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.FiniteDurationgetHeartBeatInterval()Returns the interval at which a heart beat message should be sent to remote followers.longgetIsolatedCheckIntervalInMillis()Returns the interval in which the leader needs to check if its isolated.intgetJournalRecoveryLogBatchSize()Returns the maximum number of journal log entries to batch on recovery before applying.PeerAddressResolvergetPeerAddressResolver()Returns the PeerAddressResolver.RaftPolicygetRaftPolicy()Returns the RaftPolicy used to determine certain Raft behaviors.intgetRecoverySnapshotIntervalSeconds()Returns the interval(in seconds) after which a snapshot should be taken during recovery.longgetSnapshotBatchCount()Returns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.intgetSnapshotChunkSize()Returns the maximum size (in bytes) for the snapshot chunk sent from a Leader.intgetSnapshotDataThreshold()Returns the max size of memory used in the in-memory Raft log before a snapshot should be taken.intgetSnapshotDataThresholdPercentage()Returns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken.longgetSyncIndexThreshold()Returns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.StringgetTempFileDirectory()Returns the directory in which to create temp files.voidsetCandidateElectionTimeoutDivisor(long candidateElectionTimeoutDivisor)voidsetCustomRaftPolicyImplementationClass(String customRaftPolicyImplementationClass)voidsetElectionTimeoutFactor(long electionTimeoutFactor)voidsetFileBackedStreamingThreshold(int fileBackedStreamingThreshold)voidsetHeartBeatInterval(scala.concurrent.duration.FiniteDuration heartBeatInterval)voidsetIsolatedLeaderCheckInterval(scala.concurrent.duration.FiniteDuration isolatedLeaderCheckInterval)voidsetJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize)voidsetPeerAddressResolver(@NonNull PeerAddressResolver peerAddressResolver)voidsetRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval)voidsetSnapshotBatchCount(long snapshotBatchCount)voidsetSnapshotChunkSize(int snapshotChunkSize)voidsetSnapshotDataThreshold(int snapshotDataThreshold)voidsetSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage)voidsetSyncIndexThreshold(long syncIndexThreshold)voidsetTempFileDirectory(String tempFileDirectory)
-
-
-
Method Detail
-
setHeartBeatInterval
public void setHeartBeatInterval(scala.concurrent.duration.FiniteDuration heartBeatInterval)
-
setSnapshotBatchCount
public void setSnapshotBatchCount(long snapshotBatchCount)
-
setRecoverySnapshotIntervalSeconds
public void setRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval)
-
setSnapshotDataThresholdPercentage
public void setSnapshotDataThresholdPercentage(int snapshotDataThresholdPercentage)
-
setSnapshotDataThreshold
public void setSnapshotDataThreshold(int snapshotDataThreshold)
-
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:ConfigParamsReturns the custom RaftPolicy class name.- Specified by:
getCustomRaftPolicyImplementationClassin interfaceConfigParams- Returns:
- the RaftPolicy class name or null if none set.
-
getSnapshotBatchCount
public long getSnapshotBatchCount()
Description copied from interface:ConfigParamsReturns the minimum number of entries to be present in the in-memory Raft log for a snapshot to be taken.- Specified by:
getSnapshotBatchCountin interfaceConfigParams- Returns:
- the minimum number of entries.
-
getSnapshotDataThresholdPercentage
public int getSnapshotDataThresholdPercentage()
Description copied from interface:ConfigParamsReturns the percentage of total memory used in the in-memory Raft log before a snapshot should be taken. Disabled when direct threshold is enabled.- Specified by:
getSnapshotDataThresholdPercentagein interfaceConfigParams- Returns:
- the percentage.
-
getSnapshotDataThreshold
public int getSnapshotDataThreshold()
Description copied from interface:ConfigParamsReturns the max size of memory used in the in-memory Raft log before a snapshot should be taken. 0 means that direct threshold is disabled and percentage is used instead.- Specified by:
getSnapshotDataThresholdin interfaceConfigParams- Returns:
- maximum journal size (in MiB).
-
getRecoverySnapshotIntervalSeconds
public int getRecoverySnapshotIntervalSeconds()
Description copied from interface:ConfigParamsReturns the interval(in seconds) after which a snapshot should be taken during recovery. Negative value means do not take snapshots.- Specified by:
getRecoverySnapshotIntervalSecondsin interfaceConfigParams- Returns:
- the interval of recovery snapshot in seconds
-
getHeartBeatInterval
public scala.concurrent.duration.FiniteDuration getHeartBeatInterval()
Description copied from interface:ConfigParamsReturns the interval at which a heart beat message should be sent to remote followers.- Specified by:
getHeartBeatIntervalin interfaceConfigParams- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeOutInterval
public scala.concurrent.duration.FiniteDuration getElectionTimeOutInterval()
Description copied from interface:ConfigParamsReturns the interval after which a new election should be triggered if no leader is available.- Specified by:
getElectionTimeOutIntervalin interfaceConfigParams- Returns:
- the interval as a FiniteDuration.
-
getCandidateElectionTimeoutDivisor
public long getCandidateElectionTimeoutDivisor()
Description copied from interface:ConfigParamsReturns 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:
getCandidateElectionTimeoutDivisorin interfaceConfigParams- Returns:
- the interval as a FiniteDuration.
-
getElectionTimeVariance
public int getElectionTimeVariance()
Description copied from interface:ConfigParamsReturns the maximum election time variance. The election is scheduled using both the election timeout and variance.- Specified by:
getElectionTimeVariancein interfaceConfigParams- Returns:
- the election time variance.
-
getSnapshotChunkSize
public int getSnapshotChunkSize()
Description copied from interface:ConfigParamsReturns the maximum size (in bytes) for the snapshot chunk sent from a Leader.- Specified by:
getSnapshotChunkSizein interfaceConfigParams- Returns:
- the maximum size (in bytes).
-
getJournalRecoveryLogBatchSize
public int getJournalRecoveryLogBatchSize()
Description copied from interface:ConfigParamsReturns the maximum number of journal log entries to batch on recovery before applying.- Specified by:
getJournalRecoveryLogBatchSizein interfaceConfigParams- Returns:
- the maximum number of journal log entries.
-
getIsolatedCheckIntervalInMillis
public long getIsolatedCheckIntervalInMillis()
Description copied from interface:ConfigParamsReturns the interval in which the leader needs to check if its isolated.- Specified by:
getIsolatedCheckIntervalInMillisin interfaceConfigParams- Returns:
- the interval in ms.
-
getElectionTimeoutFactor
public long getElectionTimeoutFactor()
Description copied from interface:ConfigParamsReturns 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:
getElectionTimeoutFactorin interfaceConfigParams- Returns:
- the election timeout factor.
-
getRaftPolicy
public RaftPolicy getRaftPolicy()
Description copied from interface:ConfigParamsReturns the RaftPolicy used to determine certain Raft behaviors.- Specified by:
getRaftPolicyin interfaceConfigParams- Returns:
- an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
-
getTempFileDirectory
public String getTempFileDirectory()
Description copied from interface:ConfigParamsReturns the directory in which to create temp files.- Specified by:
getTempFileDirectoryin interfaceConfigParams- Returns:
- the directory in which to create temp files.
-
getFileBackedStreamingThreshold
public int getFileBackedStreamingThreshold()
Description copied from interface:ConfigParamsReturns 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:
getFileBackedStreamingThresholdin interfaceConfigParams- Returns:
- the threshold in terms of number of bytes.
-
getPeerAddressResolver
public PeerAddressResolver getPeerAddressResolver()
Description copied from interface:ConfigParamsReturns the PeerAddressResolver.- Specified by:
getPeerAddressResolverin interfaceConfigParams- Returns:
- the PeerAddressResolver instance.
-
setPeerAddressResolver
public void setPeerAddressResolver(@NonNull PeerAddressResolver peerAddressResolver)
-
getSyncIndexThreshold
public long getSyncIndexThreshold()
Description copied from interface:ConfigParamsReturns the threshold in terms of number journal entries that we can lag behind a leader until we raise a 'not synced' transition.- Specified by:
getSyncIndexThresholdin interfaceConfigParams- Returns:
- the threshold in terms of number of journal entries.
-
setSyncIndexThreshold
public void setSyncIndexThreshold(long syncIndexThreshold)
-
-