Fix mongo latest dep test (#14642)

This commit is contained in:
Lauri Tulmin 2025-09-12 16:47:22 +03:00 committed by GitHub
parent 42c5fa13b6
commit 2a05236a56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -34,6 +34,10 @@ public class DefaultConnectionPoolTaskInstrumentation implements TypeInstrumenta
transformer.applyAdviceToMethod(
isConstructor().and(takesArgument(3, Consumer.class)),
this.getClass().getName() + "$TaskArg3Advice");
// since 5.6.0
transformer.applyAdviceToMethod(
isConstructor().and(takesArgument(4, Consumer.class)),
this.getClass().getName() + "$TaskArg4Advice");
}
@SuppressWarnings("unused")
@ -55,4 +59,14 @@ public class DefaultConnectionPoolTaskInstrumentation implements TypeInstrumenta
action = new TaskWrapper(Java8BytecodeBridge.currentContext(), action);
}
}
@SuppressWarnings("unused")
public static class TaskArg4Advice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void wrapCallback(
@Advice.Argument(value = 4, readOnly = false) Consumer<Object> action) {
action = new TaskWrapper(Java8BytecodeBridge.currentContext(), action);
}
}
}