maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven-resolver] elharo commented on a change in pull request #67: [MRESOLVER-132] Remove synchronization in TrackingFileManager
Date Tue, 18 Aug 2020 10:55:13 GMT

elharo commented on a change in pull request #67:
URL: https://github.com/apache/maven-resolver/pull/67#discussion_r472089822



##########
File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManager.java
##########
@@ -45,35 +42,28 @@
 
     public Properties read( File file )
     {
-        synchronized ( getLock( file ) )
+        FileInputStream stream = null;
+        try

Review comment:
       could use try with resources here

##########
File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/TrackingFileManager.java
##########
@@ -83,82 +73,61 @@ public Properties update( File file, Map<String, String> updates
)
     {
         Properties props = new Properties();
 
-        synchronized ( getLock( file ) )
+        File directory = file.getParentFile();
+        if ( !directory.mkdirs() && !directory.exists() )
         {
-            File directory = file.getParentFile();
-            if ( !directory.mkdirs() && !directory.exists() )
-            {
-                LOGGER.warn( "Failed to create parent directories for tracking file {}",
file );
-                return props;
-            }
+            LOGGER.warn( "Failed to create parent directories for tracking file {}", file
);
+            return props;
+        }
 
-            RandomAccessFile raf = null;
-            FileLock lock = null;
-            try
+        RandomAccessFile raf = null;

Review comment:
       RandomAccessFile still feels like a strange way to do this unless there's some synchronization
related reason here I don't see




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message