Skip to content

Changes from review comments in 8036 PR #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions patches/8036-draft.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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
index 76bb6080c73c..da54d0c76922 100644
index 76bb6080c73c..5ac38f940612 100644
--- 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
@@ -26,6 +26,7 @@
Expand All @@ -20,16 +20,15 @@ index 76bb6080c73c..da54d0c76922 100644

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


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

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

// First try the cache
if (resultCache != null) {
@@ -222,38 +228,37 @@ public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
@@ -222,38 +227,37 @@ public List<Proxy> findProxyForURL(URI uri) throws PacValidationException {
return jsResultAnalyzed;
}
}
Expand Down Expand Up @@ -73,7 +72,7 @@ index 76bb6080c73c..da54d0c76922 100644
+ jsResultAnalyzed = executeProxyScript(uri);
+ } else {
+ AtomicReference<List<Proxy>> resultHolder = new AtomicReference<>(null);
+ Task task = getRequestProcessor().post(() -> {
+ Task task = RP.post(() -> {
+ resultHolder.set(executeProxyScript(uri));
+ });
+
Expand Down Expand Up @@ -104,7 +103,7 @@ index 76bb6080c73c..da54d0c76922 100644
@Override
public boolean usesCaching() {
return (canUseURLCaching && (resultCache != null));
@@ -275,6 +280,32 @@ public String getPacScriptSource() {
@@ -275,6 +279,32 @@ public String getPacScriptSource() {
return this.pacScriptSource;
}

Expand Down Expand Up @@ -210,7 +209,7 @@ index 178c9b162feb..90812bfa4612 100644
testPacFile2("pac-test4.js", factory);
}
diff --git a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
index 2d29427cd3c2..593c99f5d6fe 100644
index 2d29427cd3c2..bb0bc42ae19f 100644
--- a/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
+++ b/platform/o.n.core/src/org/netbeans/core/ProxySettings.java
@@ -49,6 +49,8 @@ public class ProxySettings {
Expand All @@ -227,7 +226,7 @@ index 2d29427cd3c2..593c99f5d6fe 100644
}

+ public static int getPacScriptTimeout() {
+ return NbPreferences.forModule(ProxySettings.class)
+ return getPreferences ()
+ .getInt(PAC_SCRIPT_TIMEOUT, DEFAULT_TIMEOUT);
+ }

Expand Down
Loading