Record Class TopologyAwareRouter.TopologyRouterStats
java.lang.Object
java.lang.Record
com.loomcache.server.cluster.TopologyAwareRouter.TopologyRouterStats
- Record Components:
requestsByDistance- cumulative distance-weighted requestslocalReads- number of reads routed locally (distance 0)remoteReads- number of reads routed remotely
- Enclosing class:
TopologyAwareRouter
public static record TopologyAwareRouter.TopologyRouterStats(long requestsByDistance, long localReads, long remoteReads)
extends Record
Statistics for topology-aware routing.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionTopologyRouterStats(long requestsByDistance, long localReads, long remoteReads) Creates an instance of aTopologyRouterStatsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.doubleCalculate the percentage of local reads.final inthashCode()Returns a hash code value for this object.longReturns the value of thelocalReadsrecord component.longReturns the value of theremoteReadsrecord component.longReturns the value of therequestsByDistancerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TopologyRouterStats
public TopologyRouterStats(long requestsByDistance, long localReads, long remoteReads) Creates an instance of aTopologyRouterStatsrecord class.- Parameters:
requestsByDistance- the value for therequestsByDistancerecord componentlocalReads- the value for thelocalReadsrecord componentremoteReads- the value for theremoteReadsrecord component
-
-
Method Details
-
getLocalReadPercentage
public double getLocalReadPercentage()Calculate the percentage of local reads.- Returns:
- percentage of local reads (0-100), or 0 if no reads
-
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. -
requestsByDistance
public long requestsByDistance()Returns the value of therequestsByDistancerecord component.- Returns:
- the value of the
requestsByDistancerecord component
-
localReads
public long localReads()Returns the value of thelocalReadsrecord component.- Returns:
- the value of the
localReadsrecord component
-
remoteReads
public long remoteReads()Returns the value of theremoteReadsrecord component.- Returns:
- the value of the
remoteReadsrecord component
-