wu-sheng closed pull request #1572: Fix bug stop stopSpan when not createSpan
in Spring Callback
URL: https://github.com/apache/incubator-skywalking/pull/1572
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/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java
b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java
index a6879b418..234224ba3 100644
---
a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java
+++
b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/FailureCallbackInterceptor.java
@@ -51,12 +51,20 @@ public void beforeMethod(EnhancedInstance objInst, Method
method, Object[] allAr
@Override
public Object afterMethod(EnhancedInstance objInst, Method method,
Object[] allArguments, Class<?>[] argumentsTypes,
Object ret) throws Throwable {
+ Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
+ if (cacheValues == null) {
+ return ret;
+ }
ContextManager.stopSpan();
return ret;
}
@Override public void handleMethodException(EnhancedInstance objInst,
Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
+ Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
+ if (cacheValues == null) {
+ return;
+ }
ContextManager.activeSpan().errorOccurred().log(t);
}
}
diff --git
a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java
b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java
index e0ff6c27e..dcacaab7a 100644
---
a/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java
+++
b/apm-sniffer/apm-sdk-plugin/spring-plugins/concurrent-util-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/concurrent/SuccessCallbackInterceptor.java
@@ -51,12 +51,20 @@ public void beforeMethod(EnhancedInstance objInst, Method
method, Object[] allAr
@Override
public Object afterMethod(EnhancedInstance objInst, Method method,
Object[] allArguments, Class<?>[] argumentsTypes,
Object ret) throws Throwable {
+ Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
+ if (cacheValues == null) {
+ return ret;
+ }
ContextManager.stopSpan();
return ret;
}
@Override public void handleMethodException(EnhancedInstance objInst,
Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
+ Object[] cacheValues = (Object[])objInst.getSkyWalkingDynamicField();
+ if (cacheValues == null) {
+ return;
+ }
ContextManager.activeSpan().errorOccurred().log(t);
}
}
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services