bgeng777 commented on pull request #131:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/131#issuecomment-1083368542


   @gyfora when following your excellent suggestion, I notice that there are 
many duplicated lines in different `observe()` methods in our `JobObserver` and 
`SessionObserver`. The only difference is what to observe when the cluster is 
ready. It looks like we can abstract some common methods in `BaseObserver` like:
   ```java
   public void observe(FlinkDeployment flinkApp, Context context, Configuration 
defaultConfig) {
       FlinkDeploymentSpec lastReconciledSpec = ...
       // Nothing has been launched so skip observing
       if (lastReconciledSpec == null) {
           return;
       }
     
       Configuration lastValidatedConfig = ....
       if (!isClusterReady(flinkApp)) {
           observeJmDeployment(flinkApp, context, lastValidatedConfig);
       }
       if (isClusterReady(flinkApp)) {
           observeWhenClusterReady();
       }
       clearErrorsIfJobManagerDeploymentNotInErrorStatus(flinkApp);
     }
   ```
   And then implement customized `observeWhenClusterReady()` in `JobObserver` 
and `SessionObserver`. WDYT?


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to