Package io.sentry.util
Class SentryRandom
java.lang.Object
io.sentry.util.SentryRandom
This SentryRandom is a compromise used for improving performance of the SDK.
We did some testing where using Random from multiple threads degrades performance significantly. We opted for this approach as it wasn't easily possible to vendor ThreadLocalRandom since it's using advanced features that can cause java.lang.IllegalAccessError.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
SentryRandom
public SentryRandom()
-
-
Method Details
-
current
Returns the current threads instance ofRandom
. An instance ofRandom
will be created the first time this is invoked on each thread.NOTE: Avoid holding a reference to the returned
Random
instance as sharing a reference across threads (while being thread-safe) will likely degrade performance significantly.- Returns:
- random
-