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.
  • Loading branch information
andreas-schwarz-vector authored and HeikoKlare committed Feb 4, 2025
1 parent 18d50ba commit 3cfa93d
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,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 3cfa93d

Please sign in to comment.