Convert the Redisson lock span into an async span#667
Conversation
|
|
||
| RFuture<Object> future = (RFuture) ret; | ||
| CompletableFuture<Object> completableFuture = future.toCompletableFuture(); | ||
| completableFuture.whenCompleteAsync((res, ex) -> { |
There was a problem hiding this comment.
AFAIK, as you picked #whenCompleteAsync, you can't guarantee the given execution(span#asyncFinish) called in time. The execution time could be longer than expected.
There was a problem hiding this comment.
AFAIK, as you picked
#whenCompleteAsync, you can't guarantee the given execution(span#asyncFinish) called in time. The execution time could be longer than expected.
How about this
RFuture<Object> future = (RFuture) ret;
CompletableFuture<Object> completableFuture = future.toCompletableFuture();
CompletableFuture.runAsync(()->{
completableFuture.join();
span.asyncFinish();
});
There was a problem hiding this comment.
Isn't this simpler?
completableFuture.whenComplete((result, error) -> { span.asyncFinish(); });There was a problem hiding this comment.
Isn't this simpler?
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
There was a problem hiding this comment.
whenComplete should be a sync call when the future completed. Isn't it? Am I getting anything wrong?
change the completableFuture whenCompleteAsync into whenComplete

CHANGESlog.Refer Can I get the real time cost of redisson? skywalking#11799