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

    https://github.com/apache/flink/pull/5215#discussion_r160674427
  
    --- Diff: 
flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java ---
    @@ -660,7 +570,25 @@ public int run(
                                        "yarn application -kill " + 
applicationId.getOpt());
                                yarnCluster.disconnect();
                        } else {
    -                           runInteractiveCli(yarnCluster, true);
    +                           ScheduledThreadPoolExecutor 
scheduledExecutorService = new ScheduledThreadPoolExecutor(1);
    +
    +                           try (YarnApplicationStatusMonitor 
yarnApplicationStatusMonitor = new YarnApplicationStatusMonitor(
    +                                           yarnDescriptor.getYarnClient(),
    +                                           yarnCluster.getApplicationId(),
    +                                           new 
ScheduledExecutorServiceAdapter(scheduledExecutorService))) {
    --- End diff --
    
    The `ScheduledExecutor` gives a better abstraction because it does not 
expose service control methods like shutdown to the callee. I think the Java 
abstraction is slightly broken in this regard.


---

Reply via email to