Fix native mode error cause by static init of random (#862)
This commit is contained in:
parent
0edcfae368
commit
ca609c8999
|
@ -28,6 +28,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
|
@ -40,7 +41,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;
|
||||
|
@ -97,7 +97,7 @@ public final class AwsXrayRemoteSampler implements Sampler, Closeable {
|
|||
|
||||
this.pollingIntervalNanos = pollingIntervalNanos;
|
||||
// Add ~1% of jitter
|
||||
jitterNanos = RANDOM.longs(0, pollingIntervalNanos / 100).iterator();
|
||||
jitterNanos = ThreadLocalRandom.current().longs(0, pollingIntervalNanos / 100).iterator();
|
||||
|
||||
// Execute first update right away on the executor thread.
|
||||
executor.execute(this::getAndUpdateSampler);
|
||||
|
|
Loading…
Reference in New Issue