[ 
https://issues.apache.org/jira/browse/MRESOLVER-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17172644#comment-17172644
 ] 

Michael Osipov commented on MRESOLVER-68:
-----------------------------------------

I think that this ticket is not required not is the canonicalization necessary. 
The {{TrackingFileManager}} is package private, thus never used externally. It 
used the interned string reperesentation of the canonical path and file 
locking. We all know that file locking in a single JVM are pointless, it will 
lead to race conditions. This is why the locking is multistage. Single JVM and 
file locks for multi JVM. The interesting part is that if you look up the call 
stack of  {{TrackingFileManager#read(File)}} and 
{{}}{{TrackingFileManager#u}}{{pdate(File, Map<String, String>)}} you'll see 
that all of them are wrapped in a {{SyncContext}} which already add locks for 
them. I don't understand why this is done here. If outer look works, I see no 
need to lock again somewhere deeper. I am also keen to say that this kind of 
synchronization can be completely removed if you have a decent 
{{SyncContextFactory}} implementation.
 

[~elharo], please add your thoughts on my analysis.

> Add caching around File.getCanonicalPath
> ----------------------------------------
>
>                 Key: MRESOLVER-68
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-68
>             Project: Maven Resolver
>          Issue Type: Improvement
>          Components: resolver
>            Reporter: Richard Atkins
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Maven Resolver spends a lot of time calculating the canonical path for a 
> File, and subsequently interning the result, in order to generate an in 
> memory lock object for the File. This can add up to 50% or more of the time 
> in a build, especially when using maven-enforcer-plugin with the 
> bannedDependencies rule with searchTransitive true.
> Caching these lookups will reduce build times, even for well behaved plugins.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to