This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch file-lock
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 39d1ee8d725eb4883ed5194fd57900c446db7e76
Author: Michael Osipov <[email protected]>
AuthorDate: Sun Dec 12 20:32:09 2021 +0100

    Consistently use same types as in other impls
---
 .../aether/internal/impl/synccontext/named/TakariNameMapper.java | 5 +++--
 .../eclipse/aether/named/providers/FileLockNamedLockFactory.java | 9 +++++----
 .../java/org/eclipse/aether/named/support/FileLockNamedLock.java | 8 ++++----
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git 
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java
 
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java
index ffa989e..cd3cc03 100644
--- 
a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java
+++ 
b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java
@@ -34,6 +34,7 @@ import java.nio.file.Path;
 import java.util.Collection;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 /**
  * A {@link NameMapper} that creates same name mapping as Takari Local 
Repository does, with baseDir (local repo).
@@ -53,7 +54,7 @@ public class TakariNameMapper
 
     private static final char SEPARATOR = '~';
 
-    private final ConcurrentHashMap<String, Path> baseDirs;
+    private final ConcurrentMap<String, Path> baseDirs;
 
     public TakariNameMapper()
     {
@@ -126,4 +127,4 @@ public class TakariNameMapper
         }
         return baseDir.resolve( path ).toAbsolutePath().toString();
     }
-}
\ No newline at end of file
+}
diff --git 
a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java
 
b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java
index d2b765d..7e9e89d 100644
--- 
a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java
+++ 
b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java
@@ -27,6 +27,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 import javax.inject.Named;
 import javax.inject.Singleton;
@@ -50,18 +51,18 @@ public class FileLockNamedLockFactory
 {
     public static final String NAME = "file-lock";
 
-    private final ConcurrentHashMap<String, FileChannel> channels;
+    private final ConcurrentMap<String, FileChannel> fileChannels;
 
     public FileLockNamedLockFactory()
     {
-        this.channels = new ConcurrentHashMap<>();
+        this.fileChannels = new ConcurrentHashMap<>();
     }
 
     @Override
     protected NamedLockSupport createLock( final String name )
     {
         Path path = Paths.get( name );
-        FileChannel fileChannel = channels.computeIfAbsent( name, k ->
+        FileChannel fileChannel = fileChannels.computeIfAbsent( name, k ->
         {
             try
             {
@@ -84,7 +85,7 @@ public class FileLockNamedLockFactory
     @Override
     protected void destroyLock( final String name )
     {
-        FileChannel fileChannel = channels.remove( name );
+        FileChannel fileChannel = fileChannels.remove( name );
         if ( fileChannel == null )
         {
             throw new IllegalStateException( "File channel expected, but does 
not exist: " + name );
diff --git 
a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java
 
b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java
index 17e3b55..083ebd6 100644
--- 
a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java
+++ 
b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java
@@ -38,11 +38,11 @@ import static org.eclipse.aether.named.support.Retry.retry;
  * Named lock that uses {@link FileLock}. An instance of this class is about 
ONE LOCK (one file) and is possibly used
  * by multiple threads. Each thread (if properly coded re boxing) will try to 
obtain either shared or exclusive lock.
  * As file locks are JVM-scoped (so one JVM can obtain same file lock only 
once), the threads share file lock and
- * synchronize according to it. Still, as file lock obtain operation does not 
block (or in other word, the method
+ * synchronize according to it. Still, as file lock obtain operation does not 
block (or in other words, the method
  * that does block cannot be controlled for how long it blocks), we are 
"simulating" thread blocking using
  * {@link Retry} utility.
- * This implementation performs coordination on thread (JVM-local) level but 
also on process level, as long as other
- * parties are using this same "advisory" locking mechanism.
+ * This implementation performs coordination not only on thread (JVM-local) 
level, but also on process level,
+ * as long as other parties are using this same "advisory" locking mechanism.
  *
  * @since TBD
  */
@@ -58,7 +58,7 @@ public final class FileLockNamedLock
     /**
      * Thread -> steps stack (true = shared, false = exclusive)
      */
-    private final HashMap<Thread, Deque<Boolean>> threadSteps;
+    private final Map<Thread, Deque<Boolean>> threadSteps;
 
     /**
      * The {@link FileChannel} this instance is about.

Reply via email to