Refactor system requirement checks into separate methods
@@ -39,19 +39,43 @@ final class PrestoSystemRequirements
private PrestoSystemRequirements() {}
public static void verifyJvmRequirements()
+ {
+ verifyJvmVendor();
+ verifyJavaVersion();
+ verify64BitJvm();
+ verifyOsArchitecture();
+ verifyByteOrder();
+ verifyUsingG1Gc();
+ verifyFileDescriptor();
+ verifySlice();
+ }
+
+ private static void verifyJvmVendor()
{
String vendor = StandardSystemProperty.JAVA_VENDOR.value();
if (!"Oracle Corporation".equals(vendor)) {
failRequirement("Presto requires an Oracle or OpenJDK JVM (found %s)", vendor);
}
+ }
- verifyJavaVersion();
-
+ private static void verify64BitJvm()
+ {
String dataModel = System.getProperty("sun.arch.data.model");
if (!"64".equals(dataModel)) {
failRequirement("Presto requires a 64-bit JVM (found %s)", dataModel);
}
+ }
+ private static void verifyByteOrder()
+ {
+ ByteOrder order = ByteOrder.nativeOrder();
+ if (!order.equals(ByteOrder.LITTLE_ENDIAN)) {
+ failRequirement("Presto requires a little endian platform (found %s)", order);
+ }
+ }
+
+ private static void verifyOsArchitecture()
+ {
String osName = StandardSystemProperty.OS_NAME.value();
String osArch = StandardSystemProperty.OS_ARCH.value();
if ("Linux".equals(osName)) {
@@ -67,16 +91,6 @@ final class PrestoSystemRequirements
else {
failRequirement("Presto requires Linux or Mac OS X (found %s)", osName);
}
-
- if (!ByteOrder.nativeOrder().equals(ByteOrder.LITTLE_ENDIAN)) {
- failRequirement("Presto requires a little endian platform (found %s)", ByteOrder.nativeOrder());
- }
-
- verifyUsingG1Gc();
-
- verifyFileDescriptor();
-
- verifySlice();
}
private static void verifyJavaVersion()
