scwhittle commented on code in PR #33737:
URL: https://github.com/apache/beam/pull/33737#discussion_r1928368937
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/OutputObjectAndByteCounter.java:
##########
@@ -18,27 +18,28 @@
package org.apache.beam.runners.dataflow.worker.util.common.worker;
import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
import org.apache.beam.runners.core.ElementByteSizeObservable;
import org.apache.beam.runners.dataflow.worker.counters.Counter;
import
org.apache.beam.runners.dataflow.worker.counters.CounterBackedElementByteSizeObserver;
import org.apache.beam.runners.dataflow.worker.counters.CounterFactory;
import
org.apache.beam.runners.dataflow.worker.counters.CounterFactory.CounterMean;
import org.apache.beam.runners.dataflow.worker.counters.CounterName;
import org.apache.beam.runners.dataflow.worker.counters.NameContext;
+import
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.annotations.VisibleForTesting;
import org.checkerframework.checker.nullness.qual.Nullable;
/** An {@link ElementCounter} that counts output objects, bytes, and mean
bytes. */
@SuppressWarnings({
"nullness" // TODO(https://github.com/apache/beam/issues/20497)
})
public class OutputObjectAndByteCounter implements ElementCounter {
+
// Might be null, e.g., undeclared outputs will not have an
// elementByteSizeObservable.
private final ElementByteSizeObservable<Object> elementByteSizeObservable;
private final CounterFactory counterFactory;
- private Random randomGenerator = new Random();
Review Comment:
makes sense, I thought ThreadLocalRandom internally resolved each time by
thread. I missed the private constructor and current method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]