Skip to content

Commit 0275c9a

Browse files
committed
docs: explain why EventProvider lock is nullable
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
1 parent c06fdea commit 0275c9a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/dev/openfeature/sdk/EventProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ public Awaitable emit(final ProviderEvent event, final ProviderEventDetails deta
9999
// These calls need to be executed on a different thread to prevent deadlocks when the provider initialization
100100
// relies on a ready event to be emitted
101101
emitterExecutor.submit(() -> {
102+
// The lock is null when the provider has not been attached to an API instance yet.
103+
// In that case, we skip locking; the listener/emitter are already captured as local
104+
// variables above, so there is no race with a concurrent attach/detach.
102105
try (var ignored = localLock != null ? localLock.readLockAutoCloseable() : null) {
103106
if (localEventProviderListener != null) {
104107
localEventProviderListener.onEmit(event, details);

0 commit comments

Comments
 (0)