Skip to content

Commit

Permalink
make synchronization of classpath calculation more fine-grained
Browse files Browse the repository at this point in the history
Currently, the calculation of the classpath for a project is effectively a singleton because the BundleProject is used as monitor (synchronization). This leads to a poor performance if executing a tycho build with  many threads, many projects and complex dependencies.

This change replaces the global monitor with a fine-grained monitor the given project the classpath should be calculated for. This speeds up the parallel build.

(cherry picked from commit 9525ff0)
  • Loading branch information
andreas-schwarz-vector authored and eclipse-tycho-bot committed Feb 4, 2025
1 parent 5e5b061 commit 5a9fb8e
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,8 @@ public List<ClasspathEntry.AccessRule> getBootClasspathExtraAccessRules(ReactorP
return getBundleClassPath(project).getExtraBootClasspathAccessRules();
}

public synchronized BundleClassPath getBundleClassPath(ReactorProject project) {
if (project.getContextValue(CTX_CLASSPATH) instanceof BundleClassPath bundleClassPath) {
return bundleClassPath;
}
BundleClassPath cp = resolveClassPath(getMavenSession(project), getMavenProject(project));
project.setContextValue(CTX_CLASSPATH, cp);
return cp;
public BundleClassPath getBundleClassPath(ReactorProject project) {
return project.computeContextValue(CTX_CLASSPATH, () -> resolveClassPath(getMavenSession(project), getMavenProject(project)));
}

/**
Expand Down

0 comments on commit 5a9fb8e

Please sign in to comment.