Skip to content

Commit 3f05646

Browse files
pujaganidiemol
andauthored
[java] Make the connection method call back map thread-safe (#10230)
Fixes #9889 Co-authored-by: Diego Molina <[email protected]>
1 parent 7463406 commit 3f05646

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

java/src/org/openqa/selenium/devtools/Connection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
import java.io.Closeable;
3636
import java.io.StringReader;
3737
import java.time.Duration;
38-
import java.util.LinkedHashMap;
3938
import java.util.Map;
4039
import java.util.concurrent.CompletableFuture;
40+
import java.util.concurrent.ConcurrentHashMap;
4141
import java.util.concurrent.ExecutionException;
4242
import java.util.concurrent.Executor;
4343
import java.util.concurrent.Executors;
@@ -66,7 +66,7 @@ public class Connection implements Closeable {
6666
});
6767
private static final AtomicLong NEXT_ID = new AtomicLong(1L);
6868
private final WebSocket socket;
69-
private final Map<Long, Consumer<Either<Throwable, JsonInput>>> methodCallbacks = new LinkedHashMap<>();
69+
private final Map<Long, Consumer<Either<Throwable, JsonInput>>> methodCallbacks = new ConcurrentHashMap<>();
7070
private final ReadWriteLock callbacksLock = new ReentrantReadWriteLock(true);
7171
private final Multimap<Event<?>, Consumer<?>> eventCallbacks = HashMultimap.create();
7272

0 commit comments

Comments
 (0)