LadyForest commented on code in PR #22818:
URL: https://github.com/apache/flink/pull/22818#discussion_r1236617192
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/resource/ResourceManager.java:
##########
@@ -89,52 +90,41 @@ public ResourceManager(ReadableConfig config,
MutableURLClassLoader userClassLoa
* register them into the {@link ResourceManager}.
*/
public void registerJarResources(List<ResourceUri> resourceUris) throws
IOException {
- // check jar resource before register
- checkJarResources(resourceUris);
-
- Map<ResourceUri, URL> stagingResourceLocalURLs = new HashMap<>();
- for (ResourceUri resourceUri : resourceUris) {
- // check whether the resource has been registered
- if (resourceInfos.containsKey(resourceUri) &&
resourceInfos.get(resourceUri) != null) {
- LOG.info(
- "Resource [{}] has been registered, overwriting of
registered resource is not supported "
- + "in the current version, skipping.",
- resourceUri.getUri());
- continue;
- }
-
- // here can check whether the resource path is valid
- Path path = new Path(resourceUri.getUri());
- URL localUrl;
- // check resource scheme
- String scheme = StringUtils.lowerCase(path.toUri().getScheme());
- // download resource to local path firstly if in remote
- if (scheme != null && !FILE_SCHEME.equals(scheme)) {
- localUrl = downloadResource(path);
- } else {
- localUrl = getURLFromPath(path);
- // if the local jar resource is a relative path, here convert
it to absolute path
- // before register
- resourceUri = new ResourceUri(ResourceType.JAR,
localUrl.getPath());
- }
-
- // check the local jar file
- JarUtils.checkJarFile(localUrl);
-
- // add it to staging map
- stagingResourceLocalURLs.put(resourceUri, localUrl);
- }
-
- // register resource in batch
- stagingResourceLocalURLs.forEach(
- (resourceUri, url) -> {
- // jar resource need add to classloader
- userClassLoader.addURL(url);
- LOG.info("Added jar resource [{}] to class path.", url);
+ registerResources(
+ prepareStagingResources(
+ resourceUris,
+ ResourceType.JAR,
+ true,
+ url -> {
+ try {
+ JarUtils.checkJarFile(url);
+ } catch (IOException e) {
+ throw new ValidationException(e.getMessage(),
e);
Review Comment:
We're not registering a jar, actually..
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]