Add null check for the return value of `ReferenceQueue#remove()`
MODIFY
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/cache/weaklockfree/AbstractWeakConcurrentMap.java
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/cache/weaklockfree/AbstractWeakConcurrentMap.java
@@ -258,8 +258,10 @@ abstract class AbstractWeakConcurrentMap<K, V, L> implements Iterable<Map.Entry<
try {
while (!Thread.interrupted()) {
Reference<?> reference = REFERENCE_QUEUE.remove();
+ if (reference != null) {
removeWeakKey((WeakKey<?>) reference);
}
+ }
} catch (InterruptedException ignored) {
// do nothing
}

Add null check for the return value of `ReferenceQueue#remove()` (#7304)