Fix ClassCastException (#2125)

This commit is contained in:
Xin,Zhang 2019-01-06 17:21:53 +08:00 committed by 吴晟 Wu Sheng
parent 6a4e7ffc6c
commit 745e1043ff
1 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,11 @@ public class SWExecutionHookWrapper extends HystrixCommandExecutionHook {
@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 class SWExecutionHookWrapper extends HystrixCommandExecutionHook {
}
@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()) {