peachisai commented on code in PR #667:
URL: https://github.com/apache/skywalking-java/pull/667#discussion_r1460514263


##########
apm-sniffer/apm-sdk-plugin/redisson-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/redisson/v3/RedissonHighLevelLockInterceptor.java:
##########
@@ -48,7 +50,19 @@ 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 {
+        AbstractSpan span = ContextManager.activeSpan();
+        span.prepareForAsync();
         ContextManager.stopSpan();
+
+        RFuture<Object> future = (RFuture) ret;
+        CompletableFuture<Object> completableFuture = 
future.toCompletableFuture();
+        completableFuture.whenCompleteAsync((res, ex) -> {

Review Comment:
   > Isn't this simpler?
   > 
   > ```java
   > completableFuture.whenComplete((result, error) -> { span.asyncFinish(); });
   > ```
   
   Okay, I thought you mean the ```whenComplete``` may not notify listener as 
soon, consequently, i choose ```join``` method。so the question is the thread 
context change could cause another cost time



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to