wu-sheng closed pull request #2125: Fix ClassCastException URL: https://github.com/apache/incubator-skywalking/pull/2125
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java index fbe0022a00..fe7cb3c6d0 100644 --- a/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java +++ b/apm-sniffer/apm-sdk-plugin/hystrix-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hystrix/v1/SWExecutionHookWrapper.java @@ -39,6 +39,11 @@ public SWExecutionHookWrapper(HystrixCommandExecutionHook actual) { @Override public <T> void onStart(HystrixInvokable<T> commandInstance) { + if (!(commandInstance instanceof EnhancedInstance)) { + actual.onStart(commandInstance); + return; + } + EnhancedInstance enhancedInstance = (EnhancedInstance)commandInstance; EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache)enhancedInstance.getSkyWalkingDynamicField(); if (ContextManager.isActive()) { @@ -166,6 +171,11 @@ public SWExecutionHookWrapper(HystrixCommandExecutionHook actual) { } @Override public <T> void onStart(HystrixCommand<T> commandInstance) { + if (!(commandInstance instanceof EnhancedInstance)) { + actual.onStart(commandInstance); + return; + } + EnhancedInstance enhancedInstance = (EnhancedInstance)commandInstance; EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache)enhancedInstance.getSkyWalkingDynamicField(); if (ContextManager.isActive()) { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services