Fix Conflicts apm-jdk-threadpool-plugin conflicts with apm-jdk-forkjoinpool-plugin (#753)

This commit is contained in:
GuoHaoZai 2025-04-29 19:12:22 +08:00 committed by GitHub
parent f67fe0f7fd
commit 49d19464a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -6,7 +6,7 @@ Release Notes.
------------------ ------------------
* Add the virtual thread executor plugin * Add the virtual thread executor plugin
* Fix Conflicts apm-jdk-threadpool-plugin conflicts with apm-jdk-forkjoinpool-plugin
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/236?closed=1) All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/236?closed=1)

View File

@ -24,6 +24,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedI
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.concurrent.ForkJoinTask;
public abstract class AbstractThreadingPoolInterceptor implements InstanceMethodsAroundInterceptor { public abstract class AbstractThreadingPoolInterceptor implements InstanceMethodsAroundInterceptor {
@Override @Override
@ -71,6 +72,8 @@ public abstract class AbstractThreadingPoolInterceptor implements InstanceMethod
Object argument = allArguments[0]; Object argument = allArguments[0];
// Avoid duplicate enhancement, such as the case where it has already been enhanced by RunnableWrapper or CallableWrapper with toolkit. // Avoid duplicate enhancement, such as the case where it has already been enhanced by RunnableWrapper or CallableWrapper with toolkit.
return argument instanceof EnhancedInstance && ((EnhancedInstance) argument).getSkyWalkingDynamicField() instanceof ContextSnapshot; return argument instanceof EnhancedInstance
&& ((EnhancedInstance) argument).getSkyWalkingDynamicField() instanceof ContextSnapshot
&& !(argument instanceof ForkJoinTask);
} }
} }