AlexanderAshitkin commented on a change in pull request #288: [MNG-6773] Slow 
extension key creation in DefaultExtensionRealmCache under lock
URL: https://github.com/apache/maven/pull/288#discussion_r383055809
 
 

 ##########
 File path: 
maven-core/src/main/java/org/apache/maven/plugin/DefaultExtensionRealmCache.java
 ##########
 @@ -41,41 +41,46 @@
 public class DefaultExtensionRealmCache
     implements ExtensionRealmCache, Disposable
 {
+
+    private static final ConcurrentHashMap<String, FileInfo> FILE_INFO_CACHE = 
new ConcurrentHashMap<>( 512 );
+
     /**
      * CacheKey
      */
     protected static class CacheKey
         implements Key
     {
 
-        private final List<File> files;
-
-        private final List<Long> timestamps;
-
-        private final List<Long> sizes;
-
-        private final List<String> ids;
+        private final List<FileInfo> files;
 
         private final int hashCode;
 
         public CacheKey( List<Artifact> extensionArtifacts )
         {
             this.files = new ArrayList<>( extensionArtifacts.size() );
-            this.timestamps = new ArrayList<>( extensionArtifacts.size() );
-            this.sizes = new ArrayList<>( extensionArtifacts.size() );
-            this.ids = new ArrayList<>( extensionArtifacts.size() );
 
             for ( Artifact artifact : extensionArtifacts )
             {
-                File file = artifact.getFile();
-                files.add( file );
-                timestamps.add( ( file != null ) ? Long.valueOf( 
file.lastModified() ) : Long.valueOf( 0 ) );
-                sizes.add( ( file != null ) ? Long.valueOf( file.length() ) : 
Long.valueOf( 0 ) );
-                ids.add( artifact.getVersion() );
+                String artifactKey = getArtifactKey( artifact );
+                FileInfo fileInfo = FILE_INFO_CACHE.get( artifactKey );
 
 Review comment:
   Hi. By the time i i implemented this maven was on java 7. will update to v.8 
api shortly

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to