tillrohrmann commented on a change in pull request #7665: [FLINK-11551][rpc] 
Allow RpcEndpoint to execute asynchronous stop operations
URL: https://github.com/apache/flink/pull/7665#discussion_r255977453
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java
 ##########
 @@ -183,6 +177,69 @@ protected void handleRpcMessage(Object message) {
                }
        }
 
+       private void handleControlMessage(ControlMessages controlMessage) {
+               switch (controlMessage) {
+                       case START:
+                               if (state == State.STOPPED) {
+                                       state = State.STARTED;
+                               } else {
+                                       logStateTransitionWarning(state, 
State.STARTED);
+                               }
+                               break;
+                       case STOP:
+                               if (state == State.STARTED) {
+                                       state = State.STOPPED;
+                               } else {
+                                       logStateTransitionWarning(state, 
State.STOPPED);
+                               }
+                               break;
+                       case TERMINATE:
+                               terminateRpcActor();
+                               break;
+                       default:
+                               final String message = String.format("Received 
unknown control message %s. Dropping this message!", controlMessage);
+                               log.warn(message);
+                               sendErrorIfSender(new 
AkkaUnknownMessageException(message));
+               }
+       }
+
+       private void logStateTransitionWarning(State currentState, State 
targetState) {
 
 Review comment:
   I will wrap the logic in an inner class.

----------------------------------------------------------------
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

Reply via email to