tillrohrmann commented on a change in pull request #9512: 
[FLINK-13819][coordination] Introduce State for RpcEndpoint
URL: https://github.com/apache/flink/pull/9512#discussion_r318602248
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java
 ##########
 @@ -127,28 +174,53 @@ public final void start() {
        }
 
        /**
-        * User overridable callback.
+        * Internal method which is called by the RpcService implementation to 
start the RpcEndpoint.
+        *
+        * @throws Exception indicating that the rpc endpoint could not be 
started. If an exception occurs,
+        * then the rpc endpoint will automatically terminate.
+        */
+       public final void internalCallOnStart() throws Exception {
+               validateRunsInMainThread();
+               isRunning = true;
+               onStart();
+       }
+
+       /**
+        * User overridable callback which is called from {@link 
#internalCallOnStart()}.
         *
         * <p>This method is called when the RpcEndpoint is being started. The 
method is guaranteed
         * to be executed in the main thread context and can be used to start 
the rpc endpoint in the
         * context of the rpc endpoint's main thread.
         *
         * <p>IMPORTANT: This method should never be called directly by the 
user.
+        *
         * @throws Exception indicating that the rpc endpoint could not be 
started. If an exception occurs,
         * then the rpc endpoint will automatically terminate.
         */
-       public void onStart() throws Exception {}
+       protected void onStart() throws Exception {}
 
        /**
-        * Stops the rpc endpoint. This tells the underlying rpc server that 
the rpc endpoint is
+        * Triggers stop of the rpc endpoint. This tells the underlying rpc 
server that the rpc endpoint is
         * no longer ready to process remote procedure calls.
         */
        protected final void stop() {
                rpcServer.stop();
        }
 
        /**
-        * User overridable callback.
+        * Internal method which is called by the RpcService implementation to 
stop the RpcEndpoint.
+        *
+        * @return Future which is completed once all post stop actions are 
completed. If an error
+        * occurs this future is completed exceptionally
+        */
+       public final CompletableFuture<Void> internalCallOnStop() {
+               validateRunsInMainThread();
+               isRunning = false;
 
 Review comment:
   I would move it after the `onStop` to make it symmetric with the `onStart`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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