Skip to content

Commit 8361d71

Browse files
authored
Merge pull request #356 from subhash-arabhi/new-updates-8036-patch
Changes from review comments in 8036 PR
2 parents e0683e3 + 5b24214 commit 8361d71

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

patches/8036-draft.diff

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
2-
index 76bb6080c73c..da54d0c76922 100644
2+
index 76bb6080c73c..5ac38f940612 100644
33
--- a/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
44
+++ b/platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java
55
@@ -26,6 +26,7 @@
@@ -20,16 +20,15 @@ index 76bb6080c73c..da54d0c76922 100644
2020

2121
/**
2222
* NetBeans implementation of a PAC script evaluator. This implementation
23-
@@ -196,6 +200,8 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
23+
@@ -196,6 +200,7 @@ public class NbPacScriptEvaluator implements PacScriptEvaluator {
2424
private static final String PAC_SOCKS5_FFEXT = "SOCKS5"; // Mozilla Firefox extension. Not part of original Netscape spec.
2525
private static final String PAC_HTTP_FFEXT = "HTTP"; // Mozilla Firefox extension. Not part of original Netscape spec.
2626
private static final String PAC_HTTPS_FFEXT = "HTTPS"; // Mozilla Firefox extension. Not part of original Netscape spec.
27-
+ private static class RPSingleton { private static final RequestProcessor instance = new RequestProcessor(NbPacScriptEvaluator.class.getName(), Runtime.getRuntime().availableProcessors(), true, false); }
28-
+ private static RequestProcessor getRequestProcessor() { return RPSingleton.instance; }
27+
+ private static final RequestProcessor RP = new RequestProcessor(NbPacScriptEvaluator.class.getName(), Runtime.getRuntime().availableProcessors(), true, false);
2928
private final String pacScriptSource;
3029

3130

32-
@@ -213,7 +219,7 @@ public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException {
31+
@@ -213,7 +218,7 @@ public NbPacScriptEvaluator(String pacSourceCocde) throws PacParsingException {
3332
@Override
3433
public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
3534

@@ -38,7 +37,7 @@ index 76bb6080c73c..da54d0c76922 100644
3837

3938
// First try the cache
4039
if (resultCache != null) {
41-
@@ -222,38 +228,37 @@ public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
40+
@@ -222,38 +227,37 @@ public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
4241
return jsResultAnalyzed;
4342
}
4443
}
@@ -73,7 +72,7 @@ index 76bb6080c73c..da54d0c76922 100644
7372
+ jsResultAnalyzed = executeProxyScript(uri);
7473
+ } else {
7574
+ AtomicReference<List<Proxy>> resultHolder = new AtomicReference<>(null);
76-
+ Task task = getRequestProcessor().post(() -> {
75+
+ Task task = RP.post(() -> {
7776
+ resultHolder.set(executeProxyScript(uri));
7877
+ });
7978
+
@@ -104,7 +103,7 @@ index 76bb6080c73c..da54d0c76922 100644
104103
@Override
105104
public boolean usesCaching() {
106105
return (canUseURLCaching && (resultCache != null));
107-
@@ -275,6 +280,32 @@ public String getPacScriptSource() {
106+
@@ -275,6 +279,32 @@ public String getPacScriptSource() {
108107
return this.pacScriptSource;
109108
}
110109

@@ -210,7 +209,7 @@ index 178c9b162feb..90812bfa4612 100644
210209
testPacFile2("pac-test4.js", factory);
211210
}
212211
diff --git a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
213-
index 2d29427cd3c2..593c99f5d6fe 100644
212+
index 2d29427cd3c2..bb0bc42ae19f 100644
214213
--- a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
215214
+++ b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
216215
@@ -49,6 +49,8 @@ public class ProxySettings {
@@ -227,7 +226,7 @@ index 2d29427cd3c2..593c99f5d6fe 100644
227226
}
228227

229228
+ public static int getPacScriptTimeout() {
230-
+ return NbPreferences.forModule(ProxySettings.class)
229+
+ return getPreferences ()
231230
+ .getInt(PAC_SCRIPT_TIMEOUT, DEFAULT_TIMEOUT);
232231
+ }
233232

0 commit comments

Comments
 (0)