Skip to content

Commit

Permalink
Making latency array as final.
Browse files Browse the repository at this point in the history
Signed-off-by: Keshava Munegowda <[email protected]>
  • Loading branch information
kmgowda committed Apr 8, 2020
1 parent fa874dd commit 327e5c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sbk-api/src/main/java/io/sbk/api/impl/SbkPerformance.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -198,8 +199,7 @@ private void setElastic(long diffTime) {
static private class LatencyWriter {
final double[] percentiles = {0.1, 0.25, 0.5, 0.75, 0.95, 0.99, 0.999, 0.9999};
final private String action;
final private int latencyThreshold;
private int[] latencies;
final private int[] latencies;
private long startTime;
private long records;
private long latencyRecords;
Expand All @@ -211,7 +211,7 @@ static private class LatencyWriter {

LatencyWriter(String action, long start, int latencyThreshold) {
this.action = action;
this.latencyThreshold = latencyThreshold;
this.latencies = new int[latencyThreshold];
resetValues(start);
}

Expand All @@ -224,7 +224,7 @@ private void resetValues(long start) {
this.totalLatency = 0;
this.discard = 0;
this.latencyRanges = null;
this.latencies = new int[latencyThreshold];
Arrays.fill(this.latencies, 0);
}

public void reset(long start) {
Expand Down

0 comments on commit 327e5c3

Please sign in to comment.