Skip to content

Commit

Permalink
Add null check to StrictContextStorage (#5954)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Nov 6, 2023
1 parent 19196a0 commit 1ecc919
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static java.lang.Thread.currentThread;

import io.opentelemetry.context.internal.shaded.WeakConcurrentMap;
import java.lang.ref.Reference;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -266,7 +267,9 @@ List<CallerStackTrace> drainPendingCallers() {
public void run() {
try {
while (!Thread.interrupted()) {
CallerStackTrace caller = map.remove(remove());
Reference<? extends Scope> reference = remove();
// on openj9 ReferenceQueue.remove can return null
CallerStackTrace caller = reference != null ? map.remove(reference) : null;
if (caller != null && !caller.closed) {
logger.log(
Level.SEVERE, "Scope garbage collected before being closed.", callerError(caller));
Expand Down

0 comments on commit 1ecc919

Please sign in to comment.