Pochatkin commented on code in PR #2121:
URL: https://github.com/apache/ignite-3/pull/2121#discussion_r1218078510


##########
modules/compute/src/main/java/org/apache/ignite/internal/compute/JobClassLoaderFactory.java:
##########
@@ -71,22 +67,48 @@ public JobClassLoaderFactory(Function<String, Version> 
detectLastUnitVersion, Ig
      * @param units The units of the job.
      * @return The class loader.
      */
-    public JobClassLoader createClassLoader(List<DeploymentUnit> units) {
-        URL[] classPath = units.stream()
-                .map(this::constructPath)
-                .flatMap(JobClassLoaderFactory::collectClasspath)
-                .toArray(URL[]::new);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Classpath for job: " + Arrays.toString(classPath));
-        }
+    public CompletableFuture<JobClassLoader> 
createClassLoader(List<DeploymentUnit> units) {
+        Map<Integer, Stream<URL>> map = new TreeMap<>();
+
+        CompletableFuture[] futures = IntStream.range(0, units.size())
+                .mapToObj(id -> {
+                    return constructPath(units.get(id))
+                            .thenApply(JobClassLoaderFactory::collectClasspath)
+                            .thenApply(stream -> map.put(id, stream));
+                }).toArray(CompletableFuture[]::new);
+
+        return CompletableFuture.allOf(futures).thenApply(v -> {
+            return map.values().stream()
+                    .flatMap(Function.identity())
+                    .toArray(URL[]::new);
+        })
+                .thenApply(it -> new JobClassLoader(it, 
getClass().getClassLoader()))
+                .whenComplete((cl, err) -> {
+                    if (err != null) {
+                        LOG.error("Failed to create class loader", err);
+                    } else {
+                        System.out.println(map);

Review Comment:
   Remove redundant prints



-- 
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]

Reply via email to