wangyang0918 commented on a change in pull request #16607:
URL: https://github.com/apache/flink/pull/16607#discussion_r679234314



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/resources/KubernetesSharedInformer.java
##########
@@ -102,18 +91,31 @@ public Watch watch(
 
     @Override
     public void run() {
-        sharedInformerFactory.startAllRegisteredInformers();
+        startInformerAsync(sharedIndexInformer, aggregatedEventHandler);
     }
 
     @Override
     public void close() {
-        sharedInformerFactory.stopAllRegisteredInformers();
+        this.sharedIndexInformer.stop();
+        ExecutorUtils.gracefulShutdown(5, TimeUnit.SECONDS, 
this.informerExecutor);
     }
 
     private String getResourceKey(String name) {
         return client.getNamespace() + "/" + name;
     }
 
+    private void startInformerAsync(
+            SharedIndexInformer<T> informer, SharedInformerEventListener 
eventListener) {
+        informerExecutor.execute(

Review comment:
       @yittg Thanks for your hint. I think you are right. We do not need to 
start the informer anymore.
   
   Since `Informable#inform`, including run the informer internally, is not 
heavy, I will keep it in the caller thread. After then, the exception will also 
forward to the caller thread. We do not need to handle the exception in the 
`AggregatedEventHandler`.




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to