Skip to content

Commit

Permalink
MAPREDUCE-7437. spotbugs complaining about MR Fetcher class.
Browse files Browse the repository at this point in the history
Move to an atomic integer.

Change-Id: Ib53f3cd0e2b908ffe0f71cd8aa5c7af53bd52fb2
  • Loading branch information
steveloughran committed Apr 21, 2023
1 parent 83ebb39 commit b5166b6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

import javax.crypto.SecretKey;
import javax.net.ssl.HttpsURLConnection;
Expand Down Expand Up @@ -91,7 +92,7 @@ public enum ShuffleErrors{IO_ERROR, WRONG_LENGTH, BAD_ID, WRONG_MAP,
protected final ShuffleClientMetrics metrics;
protected final ExceptionReporter exceptionReporter;
protected final int id;
private static int nextId = 0;
private static final AtomicInteger nextId = new AtomicInteger(0);
protected final int reduce;

private final int connectionTimeout;
Expand All @@ -118,7 +119,7 @@ public Fetcher(JobConf job, TaskAttemptID reduceId,
Reporter reporter, ShuffleClientMetrics metrics,
ExceptionReporter exceptionReporter, SecretKey shuffleKey) {
this(job, reduceId, scheduler, merger, reporter, metrics,
exceptionReporter, shuffleKey, ++nextId);
exceptionReporter, shuffleKey, nextId.incrementAndGet());
}

@VisibleForTesting
Expand Down

0 comments on commit b5166b6

Please sign in to comment.