Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
liugddx committed Jan 10, 2024
1 parent 8694176 commit dccc372
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -265,11 +266,13 @@ public TaskDeployState deployTask(@NonNull TaskGroupImmutableInformation taskImm
"received deploying task executionId [%s]",
taskImmutableInfo.getExecutionId()));
TaskGroup taskGroup = null;
URLClassLoader classLoader =
(URLClassLoader) Thread.currentThread().getContextClassLoader();

try {
Set<ConnectorJarIdentifier> connectorJarIdentifiers =
taskImmutableInfo.getConnectorJarIdentifiers();
Set<URL> jars = taskImmutableInfo.getJars();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (!CollectionUtils.isEmpty(connectorJarIdentifiers)) {
// Prioritize obtaining the jar package file required for the current task execution
// from the local, if it does not exist locally, it will be downloaded from the
Expand Down Expand Up @@ -319,6 +322,17 @@ public TaskDeployState deployTask(@NonNull TaskGroupImmutableInformation taskImm
: "taskGroupLocation is null",
ExceptionUtils.getMessage(t)));
return TaskDeployState.failed(t);
} finally {
if (classLoader != null) {
try {
classLoader.close();
} catch (IOException e) {
logger.severe(
String.format(
"Close classLoader error with Exception: %s",
ExceptionUtils.getMessage(e)));
}
}
}
}

Expand Down

0 comments on commit dccc372

Please sign in to comment.