SIGN IN SIGN UP

perf(core): Drop per-instance lock from SentryId and SpanId (#5645)

* perf(core): Drop per-instance lock from SentryId and SpanId (JAVA-589)

SentryId and SpanId stored their string value behind a
LazyEvaluator<String>, which allocates an AutoClosableReentrantLock
(a ReentrantLock with its internal Sync) plus a capturing lambda on
every instance. Since one SentryId is created per event/transaction
and one SpanId per span, this per-instance lock machinery is far
heavier than the single String it guards, and the eager string-arg
constructors gained no laziness at all.

Replace the LazyEvaluator with a plain volatile String guarded by a
double-checked synchronized(this) block. Eager constructors now assign
the value directly; the no-arg and UUID constructors still defer
UUID-string generation. Synchronization is retained because UUID
generation is non-idempotent and two racing threads must not produce
different ids.

Follow-up to the SDK Overhead Reduction work (#5499).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* changelog

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
N
Nelson Osacky committed
0980ed763492be856f205dabfea93f14e8942878
Parent: d061260
Committed by GitHub <noreply@github.com> on 7/2/2026, 8:18:42 AM