DefaultProjectBuildingHelper: Synchronized bottleneck in parallel builds
Found in: maven-4.0.x branch
File: impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java (line 117)
Severity: Medium
Description
The entire createProjectRealm() method is synchronized, making it a global lock during multi-module parallel builds:
@Override
public synchronized ProjectRealmCache.CacheRecord createProjectRealm(
MavenProject project, Model model, ProjectBuildingRequest request)
During a multi-module build where many projects need extension realms set up concurrently, each must acquire this lock serially. Since the inner projectRealmCache uses ConcurrentHashMap and is already thread-safe, the synchronization could be narrowed to just the non-thread-safe portions.
DefaultProjectBuildingHelper: Synchronized bottleneck in parallel builds
Found in: maven-4.0.x branch
File:
impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java(line 117)Severity: Medium
Description
The entire
createProjectRealm()method issynchronized, making it a global lock during multi-module parallel builds:During a multi-module build where many projects need extension realms set up concurrently, each must acquire this lock serially. Since the inner
projectRealmCacheusesConcurrentHashMapand is already thread-safe, the synchronization could be narrowed to just the non-thread-safe portions.