|
27 | 27 | import java.util.Collection; |
28 | 28 | import java.util.Collections; |
29 | 29 | import java.util.concurrent.Callable; |
30 | | -import java.util.concurrent.Executor; |
31 | 30 | import java.util.concurrent.ForkJoinTask; |
32 | 31 | import java.util.concurrent.Future; |
33 | 32 | import net.bytebuddy.asm.Advice; |
@@ -91,9 +90,10 @@ public static class SetExecuteRunnableStateAdvice { |
91 | 90 |
|
92 | 91 | @Advice.OnMethodEnter(suppress = Throwable.class) |
93 | 92 | public static PropagatedContext enterJobSubmit( |
| 93 | + @Advice.This Object executor, |
94 | 94 | @Advice.Argument(value = 0, readOnly = false) Runnable task, |
95 | 95 | @Advice.Local("otelCallDepth") CallDepth callDepth) { |
96 | | - callDepth = CallDepth.forClass(Executor.class); |
| 96 | + callDepth = CallDepth.forClass(executor.getClass()); |
97 | 97 | if (callDepth.getAndIncrement() > 0) { |
98 | 98 | return null; |
99 | 99 | } |
@@ -155,9 +155,10 @@ public static class SetSubmitRunnableStateAdvice { |
155 | 155 |
|
156 | 156 | @Advice.OnMethodEnter(suppress = Throwable.class) |
157 | 157 | public static PropagatedContext enterJobSubmit( |
| 158 | + @Advice.This Object executor, |
158 | 159 | @Advice.Argument(value = 0, readOnly = false) Runnable task, |
159 | 160 | @Advice.Local("otelCallDepth") CallDepth callDepth) { |
160 | | - callDepth = CallDepth.forClass(Executor.class); |
| 161 | + callDepth = CallDepth.forClass(executor.getClass()); |
161 | 162 | if (callDepth.getAndIncrement() > 0) { |
162 | 163 | return null; |
163 | 164 | } |
@@ -196,8 +197,10 @@ public static class SetCallableStateAdvice { |
196 | 197 |
|
197 | 198 | @Advice.OnMethodEnter(suppress = Throwable.class) |
198 | 199 | public static PropagatedContext enterJobSubmit( |
199 | | - @Advice.Argument(0) Callable<?> task, @Advice.Local("otelCallDepth") CallDepth callDepth) { |
200 | | - callDepth = CallDepth.forClass(Executor.class); |
| 200 | + @Advice.This Object executor, |
| 201 | + @Advice.Argument(0) Callable<?> task, |
| 202 | + @Advice.Local("otelCallDepth") CallDepth callDepth) { |
| 203 | + callDepth = CallDepth.forClass(executor.getClass()); |
201 | 204 | if (callDepth.getAndIncrement() > 0) { |
202 | 205 | return null; |
203 | 206 | } |
@@ -236,13 +239,14 @@ public static class SetCallableStateForCallableCollectionAdvice { |
236 | 239 |
|
237 | 240 | @Advice.OnMethodEnter(suppress = Throwable.class) |
238 | 241 | public static Collection<?> submitEnter( |
| 242 | + @Advice.This Object executor, |
239 | 243 | @Advice.Argument(0) Collection<? extends Callable<?>> tasks, |
240 | 244 | @Advice.Local("otelCallDepth") CallDepth callDepth) { |
241 | 245 | if (tasks == null) { |
242 | 246 | return Collections.emptyList(); |
243 | 247 | } |
244 | 248 |
|
245 | | - callDepth = CallDepth.forClass(Executor.class); |
| 249 | + callDepth = CallDepth.forClass(executor.getClass()); |
246 | 250 | if (callDepth.getAndIncrement() > 0) { |
247 | 251 | return Collections.emptyList(); |
248 | 252 | } |
|
0 commit comments