liubao68 commented on a change in pull request #693: [SCB-548] support
gracefully shutdown
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/693#discussion_r187825405
##########
File path:
core/src/main/java/org/apache/servicecomb/core/handler/ShutdownHookHandler.java
##########
@@ -62,36 +66,34 @@ public void handle(Invocation invocation, AsyncResponse
asyncResp) throws Except
}
// TODO:统计功能应该独立出来,在链中统计,会有各种bug
- // 下面的两次catch,可能会导致一次请求,对应2次应答
+ // 下面的两次catch,可能会导致一次请求,对应2次应答
requestCounter.incrementAndGet();
try {
invocation.next(resp -> {
try {
asyncResp.handle(resp);
} finally {
responseCounter.incrementAndGet();
+ validAllInvocationFinished();
}
});
} catch (Throwable e) {
responseCounter.incrementAndGet();
+ validAllInvocationFinished();
throw e;
}
}
+ private synchronized void validAllInvocationFinished() {
Review comment:
This synchronized code blocking all invocations and not good idea
----------------------------------------------------------------
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