Skip to content

Commit

Permalink
[FLINK-9844][client] PackagedProgram#close() closes ClassLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Feb 3, 2021
1 parent 91f4a98 commit 3ff5361
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -89,7 +90,7 @@ public class PackagedProgram implements AutoCloseable {

private final List<URL> classpaths;

private final ClassLoader userCodeClassLoader;
private final URLClassLoader userCodeClassLoader;

private final SavepointRestoreSettings savepointSettings;

Expand Down Expand Up @@ -624,6 +625,11 @@ private static void checkJarFile(URL jarfile) throws ProgramInvocationException

@Override
public void close() {
try {
userCodeClassLoader.close();
} catch (IOException e) {
LOG.debug("Error while closing user-code classloader.", e);
}
try {
deleteExtractedLibraries();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@
import org.apache.flink.runtime.rest.messages.JobPlanInfo;
import org.apache.flink.runtime.util.BlobServerResource;
import org.apache.flink.runtime.webmonitor.TestingDispatcherGateway;
import org.apache.flink.util.OperatingSystem;
import org.apache.flink.util.TestLogger;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand All @@ -51,13 +48,6 @@ public class JarSubmissionITCase extends TestLogger {

@Rule public final BlobServerResource blobServerResource = new BlobServerResource();

@BeforeClass
public static void checkOS() {
Assume.assumeFalse(
"This test fails on Windows due to unclosed JarFiles, see FLINK-9844.",
OperatingSystem.isWindows());
}

@Test
public void testJarSubmission() throws Exception {
final TestingDispatcherGateway restfulGateway =
Expand Down

0 comments on commit 3ff5361

Please sign in to comment.