Record Class ElectionStats
java.lang.Object
java.lang.Record
com.loomcache.server.consensus.ElectionStats
- Record Components:
totalElections- Total number of election attempts (candidates)totalPreVotes- Total number of pre-vote protocol initiationssuccessfulElections- Number of successful elections (became leader)failedElections- Number of failed election attemptsavgElectionTimeMs- Average time to complete an election attempt (ms)lastElectionTerm- The most recent term in which an election occurred
public record ElectionStats(long totalElections, long totalPreVotes, long successfulElections, long failedElections, double avgElectionTimeMs, long lastElectionTerm)
extends Record
Statistics snapshot of election activity.
Captures metrics related to leader elections including pre-voting, voting attempts, success rates, and timing information.
-
Constructor Summary
ConstructorsConstructorDescriptionElectionStats(long totalElections, long totalPreVotes, long successfulElections, long failedElections, double avgElectionTimeMs, long lastElectionTerm) Creates an instance of aElectionStatsrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of theavgElectionTimeMsrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefailedElectionsrecord component.final inthashCode()Returns a hash code value for this object.longReturns the value of thelastElectionTermrecord component.longReturns the value of thesuccessfulElectionsrecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalElectionsrecord component.longReturns the value of thetotalPreVotesrecord component.
-
Constructor Details
-
ElectionStats
public ElectionStats(long totalElections, long totalPreVotes, long successfulElections, long failedElections, double avgElectionTimeMs, long lastElectionTerm) Creates an instance of aElectionStatsrecord class.- Parameters:
totalElections- the value for thetotalElectionsrecord componenttotalPreVotes- the value for thetotalPreVotesrecord componentsuccessfulElections- the value for thesuccessfulElectionsrecord componentfailedElections- the value for thefailedElectionsrecord componentavgElectionTimeMs- the value for theavgElectionTimeMsrecord componentlastElectionTerm- the value for thelastElectionTermrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
totalElections
public long totalElections()Returns the value of thetotalElectionsrecord component.- Returns:
- the value of the
totalElectionsrecord component
-
totalPreVotes
public long totalPreVotes()Returns the value of thetotalPreVotesrecord component.- Returns:
- the value of the
totalPreVotesrecord component
-
successfulElections
public long successfulElections()Returns the value of thesuccessfulElectionsrecord component.- Returns:
- the value of the
successfulElectionsrecord component
-
failedElections
public long failedElections()Returns the value of thefailedElectionsrecord component.- Returns:
- the value of the
failedElectionsrecord component
-
avgElectionTimeMs
public double avgElectionTimeMs()Returns the value of theavgElectionTimeMsrecord component.- Returns:
- the value of the
avgElectionTimeMsrecord component
-
lastElectionTerm
public long lastElectionTerm()Returns the value of thelastElectionTermrecord component.- Returns:
- the value of the
lastElectionTermrecord component
-