You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/06/14 08:16:16 UTC

[GitHub] WillemJiang commented on a change in pull request #769: [SCB-667] fix gracefully shutdown is not work in some case

WillemJiang commented on a change in pull request #769: [SCB-667] fix gracefully shutdown is not work in some case
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/769#discussion_r195336085
 
 

 ##########
 File path: common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
 ##########
 @@ -160,16 +163,24 @@ public void invoke() {
   }
 
   protected Response prepareInvoke() throws Throwable {
-    this.initProduceProcessor();
+    SCBStatus currentStatus = SCBEngine.getInstance().getStatus();
+    if (SCBStatus.UP.equals(currentStatus)) {
+      this.initProduceProcessor();
 
-    this.setContext();
-    invocation.getHandlerContext().put(RestConst.REST_REQUEST, requestEx);
+      this.setContext();
+      invocation.getHandlerContext().put(RestConst.REST_REQUEST, requestEx);
 
-    for (HttpServerFilter filter : httpServerFilters) {
-      Response response = filter.afterReceiveRequest(invocation, requestEx);
-      if (response != null) {
-        return response;
+      for (HttpServerFilter filter : httpServerFilters) {
+        Response response = filter.afterReceiveRequest(invocation, requestEx);
+        if (response != null) {
+          return response;
+        }
       }
+    } else {
+      LOGGER.warn(
+          "System is starting and not ready for remote calls or shutting down in progress, STATUS = " + currentStatus);
 
 Review comment:
   The Request is rejected, as the service provider cannot  process the request due to STATUS =  (you can add the status information here). 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services