gnodet commented on a change in pull request #533: URL: https://github.com/apache/maven/pull/533#discussion_r707111626
########## File path: maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java ########## @@ -387,6 +404,36 @@ private PluginVersionResult resolveFromProject( PluginVersionRequest request, Li return null; } + @SuppressWarnings( "unchecked" ) + private Map<String, PluginVersionResult> getCache( SessionData data ) + { + Map<String, PluginVersionResult> cache = ( Map<String, PluginVersionResult> ) data.get( CACHE_KEY ); + while ( cache == null ) + { + cache = new ConcurrentHashMap<>( 256 ); + if ( data.set( CACHE_KEY, null, cache ) ) + { + break; + } + cache = ( Map<String, PluginVersionResult> ) data.get( CACHE_KEY ); + } + return cache; + } + + private static String getKey( PluginVersionRequest request ) + { + StringBuilder sb = new StringBuilder(); + sb.append( request.getGroupId() ); + sb.append( ':' ); + sb.append( request.getArtifactId() ); + for ( RemoteRepository repository : request.getRepositories() ) Review comment: @rfscholte @michael-o I'll change the key to use a class that will contain groupId / artifactId / repositories and use a correct equals/hashCode implementation... (fwiw, and we do have access to the full repository definition as it's actually used for downloading the metadata...) @michael-o I don't think we should assume too much about how the PluginVersionResolver is used, i.e. the fact that we don't care about where the repository come from is irrelevant I think. The cache should be coherent and should not assume too much beyond the fact that the request/result mapping is stable, i.e. do not assume that different requests may lead to the same results, or that the requests in a given maven session will always have the same list of repositories or that the id/url mapping of the repositories is stable... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org