| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| 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.
Sorry, something went wrong.
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();
});
Sorry, something went wrong.
There was a problem hiding this comment.
Isn't this simpler?
completableFuture.whenComplete((result, error) -> { span.asyncFinish(); });
Sorry, something went wrong.
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
Sorry, something went wrong.
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?
Sorry, something went wrong.
Sorry, something went wrong.
change the completableFuture whenCompleteAsync into whenComplete
| Back | FazBrowse Home | New Git URL |
Refer Can I get the real time cost of redisson? skywalking#11799