mbien commented on code in PR #8036:
URL: https://github.com/apache/netbeans/pull/8036#discussion_r1898139957
##########
platform/core.network/src/org/netbeans/core/network/proxy/pac/impl/NbPacScriptEvaluator.java:
##########
@@ -196,6 +200,8 @@ 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; }
Review Comment:
I too am not convinced that this would gain anything. Since RP itself is
lazy. All you safe is the RP object and few internal fields of it.
btw the least-bad version of this idiom is JDK 17+.
change to `javac.release=17` in project properties
```java
private static RequestProcessor getRequestProcessor() {
class Lazy {
static final RequestProcessor RP = new
RequestProcessor(NbPacScriptEvaluator.class.getName(),
Runtime.getRuntime().availableProcessors(), true, false);
}
return Lazy.RP;
}
```
keeps the hack local. (also please don't write everything in one line)
But please clarify why this is needed if you still think this is needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists