1
1
diff --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
3
3
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/ConnectionSpec.java
4
4
+++ 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;
6
6
import java.net.Inet4Address;
7
7
import java.net.ServerSocket;
8
8
import java.net.Socket;
9
- - import java.net.SocketException;
10
9
+ import java.security.SecureRandom;
11
10
import java.util.ArrayList;
12
11
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;
15
14
"MSG_PortParseError=Cannot parse '{1}' as port in '{0}'"
16
15
})
17
16
final class ConnectionSpec implements Closeable {
@@ -20,7 +19,7 @@ index bb8a4e8183..b9662fe6cd 100644
20
19
+ private final boolean hash;
21
20
private final int port;
22
21
// @GuardedBy (this)
23
- private final List<Closeable> close = new ArrayList <>();
22
+ private final List<Closeable> close = new CopyOnWriteArrayList <>();
24
23
// @GuardedBy (this)
25
24
private final List<Closeable> closed = new ArrayList<>();
26
25
@@ -55,7 +54,7 @@ index bb8a4e8183..b9662fe6cd 100644
55
54
56
55
}
57
56
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 {
59
58
// listen on TCP
60
59
ServerSocket server = new ServerSocket(port, 1, Inet4Address.getLoopbackAddress());
61
60
close.add(server);
@@ -77,7 +76,7 @@ index bb8a4e8183..b9662fe6cd 100644
77
76
int localPort = server.getLocalPort();
78
77
Thread listeningThread = new Thread(prefix + " listening at port " + localPort) {
79
78
@Override
80
- @@ -118,7 +141 ,7 @@ final class ConnectionSpec implements Closeable {
79
+ @@ -118,7 +142 ,7 @@ final class ConnectionSpec implements Closeable {
81
80
try {
82
81
socket = server.accept();
83
82
close.add(socket);
@@ -86,7 +85,7 @@ index bb8a4e8183..b9662fe6cd 100644
86
85
} catch (IOException ex) {
87
86
if (isClosed(server)) {
88
87
break;
89
- @@ -130,25 +153 ,53 @@ final class ConnectionSpec implements Closeable {
88
+ @@ -130,25 +154 ,53 @@ final class ConnectionSpec implements Closeable {
90
89
};
91
90
listeningThread.start();
92
91
out.write((prefix + " listening at port " + localPort + "\n").getBytes());
0 commit comments