You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/06/16 10:10:34 UTC

(maven-resolver) 02/34: Fix IpcServer clients HashMap — use ConcurrentHashMap

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

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

commit b241f2a022f17c59ed3e817cf21bcf267ccd46d1
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Sun Jun 7 06:21:48 2026 +0000

    Fix IpcServer clients HashMap — use ConcurrentHashMap
    
    F-03: Replace plain HashMap with ConcurrentHashMap for the clients
    map so that close() and expirationCheck() can safely access it
    without synchronization, preventing ConcurrentModificationException
    and data races.
---
 .../src/main/java/org/eclipse/aether/named/ipc/IpcServer.java          | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcServer.java b/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcServer.java
index 1f8386f18..dcafa4cba 100644
--- a/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcServer.java
+++ b/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcServer.java
@@ -27,7 +27,6 @@ import java.nio.channels.Channels;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -111,7 +110,7 @@ public class IpcServer {
     public static final boolean DEFAULT_DEBUG = false;
 
     private final ServerSocketChannel serverSocket;
-    private final Map<SocketChannel, Thread> clients = new HashMap<>();
+    private final Map<SocketChannel, Thread> clients = new ConcurrentHashMap<>();
     private final AtomicInteger counter = new AtomicInteger();
     private final Map<String, Lock> locks = new ConcurrentHashMap<>();
     private final Map<String, Context> contexts = new ConcurrentHashMap<>();