Skip to content

Commit 93e0c9c

Browse files
committed
Fix native mode error cause by static init of random
1 parent 7c205af commit 93e0c9c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

aws-xray/src/main/java/io/opentelemetry/contrib/awsxray/AwsXrayRemoteSampler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public final class AwsXrayRemoteSampler implements Sampler, Closeable {
4040

4141
static final long DEFAULT_TARGET_INTERVAL_NANOS = TimeUnit.SECONDS.toNanos(10);
4242

43-
private static final Random RANDOM = new Random();
4443
private static final Logger logger = Logger.getLogger(AwsXrayRemoteSampler.class.getName());
4544

4645
private final Resource resource;
@@ -97,7 +96,7 @@ public static AwsXrayRemoteSamplerBuilder newBuilder(Resource resource) {
9796

9897
this.pollingIntervalNanos = pollingIntervalNanos;
9998
// Add ~1% of jitter
100-
jitterNanos = RANDOM.longs(0, pollingIntervalNanos / 100).iterator();
99+
jitterNanos = new Random().longs(0, pollingIntervalNanos / 100).iterator();
101100

102101
// Execute first update right away on the executor thread.
103102
executor.execute(this::getAndUpdateSampler);

0 commit comments

Comments
 (0)