On Tue, 29 Oct 2024 22:46:30 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java >> line 142: >> >>> 140: >>> 141: private static final boolean multithreaded = initMultithreaded(); >>> 142: private static boolean initMultithreaded() { >> >> Have you considered a pattern such as this? >> >> >> private static final boolean multithreaded = ((Supplier<Boolean>)() -> { >> // If it is not specified, or it is true, then it should >> // be true. Otherwise it should be false. >> String value = System.getProperty("quantum.multithreaded"); >> if (value == null) return true; >> final boolean result = Boolean.parseBoolean(value); >> if (verbose) { >> System.out.println(result ? "Multi-Threading Enabled" : >> "Multi-Threading Disabled"); >> } >> return result; >> }).get(); >> >> >> This would prevent a proliferation of many new init methods. > > That's an interesting suggestion: trading a new method for a lambda (the > prior code used a lambda to pass to the doPrivileged, so it's also less of a > delta). I'll take a look at it and see if it looks better to me. I decided to make this change. Thanks for the suggestion. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1608#discussion_r1823362381