Class DefaultConfigParamsImpl

  • All Implemented Interfaces:
    ConfigParams

    public class DefaultConfigParamsImpl
    extends Object
    implements ConfigParams
    Default implementation of the ConfigParams.
    • Field Detail

      • HEART_BEAT_INTERVAL

        public static final scala.concurrent.duration.FiniteDuration HEART_BEAT_INTERVAL
        The interval at which a heart beat message will be sent to the remote RaftActor.

        Since this is set to 100 milliseconds the Election timeout should be at least 200 milliseconds

    • Constructor Detail

      • DefaultConfigParamsImpl

        public DefaultConfigParamsImpl()
    • 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)
      • 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)
      • 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 interface ConfigParams
        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 interface ConfigParams
        Returns:
        the percentage.
      • getRecoverySnapshotIntervalSeconds

        public int getRecoverySnapshotIntervalSeconds()
        Description copied from interface: ConfigParams
        Returns the interval(in seconds) after which a snapshot should be taken during recovery. Negative value means don't take snapshots.
        Specified by:
        getRecoverySnapshotIntervalSeconds in interface ConfigParams
        Returns:
        the interval of recovery snapshot in seconds
      • 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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        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 interface ConfigParams
        Returns:
        the threshold in terms of number of bytes.
      • 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 interface ConfigParams
        Returns:
        the threshold in terms of number of journal entries.
      • setSyncIndexThreshold

        public void setSyncIndexThreshold​(long syncIndexThreshold)