- // create jars
- for (String bundle : bundles)
- createBundle(bundle, category);
+ long begin = System.currentTimeMillis();
+ // create jars in parallel
+ List<CompletableFuture<Void>> toDos = new ArrayList<>();
+ for (String bundle : bundles) {
+ toDos.add(CompletableFuture.runAsync(() -> {
+ try {
+ createBundle(bundle, category);
+ } catch (IOException e) {
+ throw new RuntimeException("Packaging of " + bundle + " failed", e);
+ }
+ }));
+ }
+ CompletableFuture.allOf(toDos.toArray(new CompletableFuture[toDos.size()])).join();
+ long duration = System.currentTimeMillis() - begin;
+ logger.log(INFO, "Packaging took " + duration + " ms");