Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix native mode error cause by static init of random #862

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public final class AwsXrayRemoteSampler implements Sampler, Closeable {

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

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

private final Resource resource;
Expand Down Expand Up @@ -97,7 +96,7 @@ public static AwsXrayRemoteSamplerBuilder newBuilder(Resource resource) {

this.pollingIntervalNanos = pollingIntervalNanos;
// Add ~1% of jitter
jitterNanos = RANDOM.longs(0, pollingIntervalNanos / 100).iterator();
jitterNanos = new Random().longs(0, pollingIntervalNanos / 100).iterator();
brunobat marked this conversation as resolved.
Show resolved Hide resolved

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