You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2021/02/05 11:40:15 UTC

[flink] branch release-1.12 updated: [FLINK-21210][coordination] ApplicationClusterEntryPoint explicitly closes PackagedProgram

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.12
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.12 by this push:
     new e129094  [FLINK-21210][coordination] ApplicationClusterEntryPoint explicitly closes PackagedProgram
e129094 is described below

commit e129094e458f7f9a2c3f495cdc336df1e365eb44
Author: SteNicholas <pr...@163.com>
AuthorDate: Fri Feb 5 19:15:29 2021 +0800

    [FLINK-21210][coordination] ApplicationClusterEntryPoint explicitly closes PackagedProgram
---
 .../deployment/application/ApplicationClusterEntryPoint.java   | 10 +++++++++-
 .../org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/flink-clients/src/main/java/org/apache/flink/client/deployment/application/ApplicationClusterEntryPoint.java b/flink-clients/src/main/java/org/apache/flink/client/deployment/application/ApplicationClusterEntryPoint.java
index ef96c2a..30e872d 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/deployment/application/ApplicationClusterEntryPoint.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/deployment/application/ApplicationClusterEntryPoint.java
@@ -37,6 +37,7 @@ import org.apache.flink.runtime.entrypoint.component.DispatcherResourceManagerCo
 import org.apache.flink.runtime.resourcemanager.ResourceManagerFactory;
 import org.apache.flink.runtime.rest.JobRestEndpointFactory;
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
@@ -47,7 +48,7 @@ import static org.apache.flink.util.Preconditions.checkNotNull;
 
 /**
  * Base class for cluster entry points targeting executing applications in "Application Mode". The
- * lifecycle of the enrtypoint is bound to that of the specific application being executed, and the
+ * lifecycle of the entry point is bound to that of the specific application being executed, and the
  * {@code main()} method of the application is run on the cluster.
  */
 public class ApplicationClusterEntryPoint extends ClusterEntrypoint {
@@ -114,4 +115,11 @@ public class ApplicationClusterEntryPoint extends ClusterEntrypoint {
         return Collections.unmodifiableList(
                 classpath.stream().distinct().collect(Collectors.toList()));
     }
+
+    @Override
+    protected void cleanupDirectories() throws IOException {
+        // Close the packaged program explicitly to clean up temporary jars.
+        program.close();
+        super.cleanupDirectories();
+    }
 }
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java b/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java
index a3c42b7..6e6a604 100755
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java
@@ -507,7 +507,7 @@ public abstract class ClusterEntrypoint implements AutoCloseableAsync, FatalErro
      *
      * @throws IOException if the temporary directories could not be cleaned up
      */
-    private void cleanupDirectories() throws IOException {
+    protected void cleanupDirectories() throws IOException {
         ShutdownHookUtil.removeShutdownHook(shutDownHook, getClass().getSimpleName(), LOG);
 
         final String webTmpDir = configuration.getString(WebOptions.TMP_DIR);