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_r317617135
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java
 ##########
 @@ -112,12 +117,23 @@ public String getEndpointId() {
                return endpointId;
        }
 
+       /**
+        * Returns the rpc endpoint's state.
+        *
+        * <p>IMPORTANT: the state is not thread safe and can be used only in 
the main thread of the rpc endpoint.
+        *
+        * @return Rpc endpoint's state.
+        */
+       public State getState() {
 
 Review comment:
   Instead of exposing the internal state machine of the `RpcEndpoint` via 
`State`, I think it would be better to define a method `public final boolean 
isRunning()` which returns `true` if the state is `Running` and if not, then it 
returns `false`. This method could validate that it is only called from the 
main thread by calling `validateRunsInMainThread`.

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