Commit efdcaec 1 parent 6c30188 commit efdcaec Copy full SHA for efdcaec
File tree 1 file changed +11
-0
lines changed
com.archimatetool.editor/src/com/archimatetool/editor/utils
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ public final class NetUtils {
39
39
// Store the default ProxySelector before we set ours
40
40
private static final ProxySelector DEFAULT_PROXY_SELECTOR = ProxySelector .getDefault ();
41
41
42
+ // Timeout in milliseconds
43
+ private static final int CONNECTION_TIMEOUT = 20000 ;
44
+
42
45
private static Authenticator AUTHENTICATOR = new Authenticator () {
43
46
@ Override
44
47
public PasswordAuthentication getPasswordAuthentication () {
@@ -72,6 +75,10 @@ public static void initialise() {
72
75
73
76
// And this one too, but not sure. I think it's for HTTP
74
77
System .setProperty ("jdk.http.auth.proxying.disabledSchemes" , "" );
78
+
79
+ // Set global timeouts. These might or might not work
80
+ System .setProperty ("sun.net.client.defaultConnectTimeout" , Integer .toString (CONNECTION_TIMEOUT ));
81
+ System .setProperty ("sun.net.client.defaultReadTimeout" , Integer .toString (CONNECTION_TIMEOUT ));
75
82
76
83
// Set default proxy now
77
84
setDefaultProxy ();
@@ -97,6 +104,10 @@ public static URLConnection openConnection(URL url) throws IOException {
97
104
else {
98
105
connection = url .openConnection ();
99
106
}
107
+
108
+ // Set timeouts, these will work even if the global poperties don't
109
+ connection .setConnectTimeout (CONNECTION_TIMEOUT );
110
+ connection .setReadTimeout (CONNECTION_TIMEOUT );
100
111
101
112
return connection ;
102
113
}
You can’t perform that action at this time.
0 commit comments