Fix Netty addListener instrumentation (#10254)

This commit is contained in:
Roman Kvasnytskyi 2024-01-18 10:26:23 +01:00 committed by GitHub
parent e28f0dfcf2
commit 9e208c8574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -43,7 +43,7 @@ public final class FutureListenerWrappers {
};
public static boolean shouldWrap(GenericFutureListener<? extends Future<?>> listener) {
return shouldWrap.get(listener.getClass());
return listener != null && shouldWrap.get(listener.getClass());
}
@SuppressWarnings("unchecked")

View File

@ -82,6 +82,8 @@ public class NettyFutureInstrumentation implements TypeInstrumentation {
for (int i = 0; i < listeners.length; ++i) {
if (FutureListenerWrappers.shouldWrap(listeners[i])) {
wrappedListeners[i] = FutureListenerWrappers.wrap(context, listeners[i]);
} else {
wrappedListeners[i] = listeners[i];
}
}
listeners = wrappedListeners;