Skip to content

Commit

Permalink
Close ForkJoinPool
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Apr 11, 2024
1 parent 530a07c commit 6bdf9b4
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ public ModelSource resolveModel(String groupId, String artifactId, String versio

record Result(ModelSource source, Parent parent, Exception e) {}

private ForkJoinPool pool = new ForkJoinPool(MAX_CAP);

@Override
public ModelSource resolveModel(final Parent parent, AtomicReference<Parent> modified)
throws UnresolvableModelException {
Expand Down Expand Up @@ -216,8 +214,13 @@ protected boolean exec() {
return true;
}
});
pool.execute(future);
result = future.get();
ForkJoinPool pool = new ForkJoinPool(MAX_CAP);
try {
pool.execute(future);
result = future.get();
} finally {
pool.shutdownNow();
}
} catch (Exception e) {
throw new UnresolvableModelException(e, parent.getGroupId(), parent.getArtifactId(), parent.getVersion());
}
Expand Down

0 comments on commit 6bdf9b4

Please sign in to comment.