Github user shixiaogang commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2377#discussion_r75481109
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/jobmaster/JobMaster.java
 ---
    @@ -248,4 +374,40 @@ void 
finishResourceManagerRegistration(ResourceManagerGateway resourceManager, I
        public boolean isConnected() {
                return resourceManager != null;
        }
    +
    +
    +   /**
    +    * Cancel the current job and notify all listeners the job's 
cancellation.
    +    *
    +    * @param cause Cause for the cancelling.
    +    */
    +   private void cancelAndClearEverything(Throwable cause) {
    +           // currently, nothing to do here
    +   }
    +
    +   // 
------------------------------------------------------------------------
    +   //  Utility classes
    +   // 
------------------------------------------------------------------------
    +   private class JobMasterLeaderContender implements LeaderContender {
    --- End diff --
    
    I used to make JobMaster implement the LeaderContender interface. But after 
checking Stephan's implementation of TaskExecutor, I modified my implementation 
:)
    
    JobMaster is not only a contender for JM's leader, but also a listener of 
RM's leader. If we let JM directly implement the `LeaderContender` interface, 
then we should also make JM implement the `LeaderRetrieval` interface. Note 
that the two interfaces both have the method called `handleError`. The 
implementation of `handleError` will be very difficult because we have to check 
the causes of the exception: if the JM's contention for leadership fails, the 
JM should kill itself. But in the cases where the listener of RM fails, JM can 
just wait there for the RM's recovery. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to