avoid ThreadPoolExecutor duplicate enhancement (#582)
Co-authored-by: xiaqi <xiaqi@51xf.cn>
This commit is contained in:
parent
d5ec43848f
commit
fbabc3d3ab
|
|
@ -147,6 +147,7 @@ Callable {
|
|||
* Support to trace redisson lock
|
||||
* Upgrade netty-codec-http2 to 4.1.94.Final
|
||||
* Upgrade guava to 32.0.1
|
||||
* Fix issue with duplicate enhancement by ThreadPoolExecutor
|
||||
|
||||
#### Documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.skywalking.apm.plugin;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
|
|
@ -37,6 +38,11 @@ public abstract class AbstractThreadingPoolInterceptor implements InstanceMethod
|
|||
|
||||
Object argument = allArguments[0];
|
||||
|
||||
// Avoid duplicate enhancement, such as the case where it has already been enhanced by RunnableWrapper or CallableWrapper with toolkit.
|
||||
if (argument instanceof EnhancedInstance && ((EnhancedInstance) argument).getSkyWalkingDynamicField() instanceof ContextSnapshot) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object wrappedObject = wrap(argument);
|
||||
if (wrappedObject != null) {
|
||||
allArguments[0] = wrappedObject;
|
||||
|
|
|
|||
Loading…
Reference in New Issue