11diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ConnectionSpec.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ConnectionSpec.java
2- index bb8a4e8183..b9662fe6cd 100644
2+ index 6a64eb01f7..c994ac0c39 100644
33--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ConnectionSpec.java
44+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ConnectionSpec.java
5- @@ -25,7 +25,7 @@ import java.io.OutputStream;
5+ @@ -25,6 +25,7 @@ import java.io.OutputStream;
66 import java.net.Inet4Address;
77 import java.net.ServerSocket;
88 import java.net.Socket;
9- - import java.net.SocketException;
109+ import java.security.SecureRandom;
1110 import java.util.ArrayList;
1211 import java.util.List;
13- import java.util.concurrent.ExecutionException ;
14- @@ -45,31 +45 ,39 @@ import org.openide.util.Pair;
12+ import java.util.concurrent.CopyOnWriteArrayList ;
13+ @@ -45,31 +46 ,39 @@ import org.openide.util.Pair;
1514 "MSG_PortParseError=Cannot parse '{1}' as port in '{0}'"
1615 })
1716 final class ConnectionSpec implements Closeable {
@@ -20,7 +19,7 @@ index bb8a4e8183..b9662fe6cd 100644
2019+ private final boolean hash;
2120 private final int port;
2221 // @GuardedBy (this)
23- private final List<Closeable> close = new ArrayList <>();
22+ private final List<Closeable> close = new CopyOnWriteArrayList <>();
2423 // @GuardedBy (this)
2524 private final List<Closeable> closed = new ArrayList<>();
2625
@@ -55,7 +54,7 @@ index bb8a4e8183..b9662fe6cd 100644
5554
5655 }
5756 throw new CommandException(555, Bundle.MSG_ConnectionSpecError(spec));
58- @@ -109,6 +117 ,21 @@ final class ConnectionSpec implements Closeable {
57+ @@ -109,6 +118 ,21 @@ final class ConnectionSpec implements Closeable {
5958 // listen on TCP
6059 ServerSocket server = new ServerSocket(port, 1, Inet4Address.getLoopbackAddress());
6160 close.add(server);
@@ -77,7 +76,7 @@ index bb8a4e8183..b9662fe6cd 100644
7776 int localPort = server.getLocalPort();
7877 Thread listeningThread = new Thread(prefix + " listening at port " + localPort) {
7978 @Override
80- @@ -118,7 +141 ,7 @@ final class ConnectionSpec implements Closeable {
79+ @@ -118,7 +142 ,7 @@ final class ConnectionSpec implements Closeable {
8180 try {
8281 socket = server.accept();
8382 close.add(socket);
@@ -86,7 +85,7 @@ index bb8a4e8183..b9662fe6cd 100644
8685 } catch (IOException ex) {
8786 if (isClosed(server)) {
8887 break;
89- @@ -130,25 +153 ,53 @@ final class ConnectionSpec implements Closeable {
88+ @@ -130,25 +154 ,53 @@ final class ConnectionSpec implements Closeable {
9089 };
9190 listeningThread.start();
9291 out.write((prefix + " listening at port " + localPort + "\n").getBytes());
0 commit comments