mirror of
https://github.com/apache/rocketmq.git
synced 2026-08-30 18:10:44 +08:00
modify variable name whichItemWorst to randomItem to resolve ambiguity (#5436)
This commit is contained in:
+3
-3
@@ -27,7 +27,7 @@ import org.apache.rocketmq.client.common.ThreadLocalIndex;
|
||||
public class LatencyFaultToleranceImpl implements LatencyFaultTolerance<String> {
|
||||
private final ConcurrentHashMap<String, FaultItem> faultItemTable = new ConcurrentHashMap<>(16);
|
||||
|
||||
private final ThreadLocalIndex whichItemWorst = new ThreadLocalIndex();
|
||||
private final ThreadLocalIndex randomItem = new ThreadLocalIndex();
|
||||
|
||||
@Override
|
||||
public void updateFaultItem(final String name, final long currentLatency, final long notAvailableDuration) {
|
||||
@@ -76,7 +76,7 @@ public class LatencyFaultToleranceImpl implements LatencyFaultTolerance<String>
|
||||
if (half <= 0) {
|
||||
return tmpList.get(0).getName();
|
||||
} else {
|
||||
final int i = this.whichItemWorst.incrementAndGet() % half;
|
||||
final int i = this.randomItem.incrementAndGet() % half;
|
||||
return tmpList.get(i).getName();
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class LatencyFaultToleranceImpl implements LatencyFaultTolerance<String>
|
||||
public String toString() {
|
||||
return "LatencyFaultToleranceImpl{" +
|
||||
"faultItemTable=" + faultItemTable +
|
||||
", whichItemWorst=" + whichItemWorst +
|
||||
", whichItemWorst=" + randomItem +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user