JackBuggins commented on code in PR #4537:
URL: https://github.com/apache/hadoop/pull/4537#discussion_r1044746318
##########
hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/util/PlatformName.java:
##########
@@ -33,16 +39,33 @@ public class PlatformName {
* per the java-vm.
*/
public static final String PLATFORM_NAME =
- (System.getProperty("os.name").startsWith("Windows")
- ? System.getenv("os") : System.getProperty("os.name"))
- + "-" + System.getProperty("os.arch")
- + "-" + System.getProperty("sun.arch.data.model");
+ (System.getProperty("os.name").startsWith("Windows") ?
+ System.getenv("os") : System.getProperty("os.name"))
+ + "-" + System.getProperty("os.arch") + "-"
+ + System.getProperty("sun.arch.data.model");
/**
* The java vendor name used in this platform.
*/
public static final String JAVA_VENDOR_NAME =
System.getProperty("java.vendor");
+ /**
+ * A concurrently accessible hashmap that saves re-computation of vendor
checks.
+ */
+ private static final Map<String, Boolean> SYSTEM_CLASS_AVAILABILITY = new
ConcurrentHashMap<>();
Review Comment:
Findbugs was warning about initiating an instance outside of a doPrivileged
call despite that being private, so keeping this private but static was the
compromise made to avoid adding exceptions. Originally I would've been tempted
to keep this non static and use the instance each time, as well as writing the
result to a concurrent map so we could only run the computation if it did not
exist.
--
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]