8066599: Add methods to check VM mode to c.o.j.t.Platform
Reviewed-by: iignatyev
This commit is contained in:
parent
c6e7f87632
commit
2489b87d30
@ -34,6 +34,7 @@ public class Platform {
|
|||||||
private static final String vmName = System.getProperty("java.vm.name");
|
private static final String vmName = System.getProperty("java.vm.name");
|
||||||
private static final String userName = System.getProperty("user.name");
|
private static final String userName = System.getProperty("user.name");
|
||||||
private static final String compiler = System.getProperty("sun.management.compiler");
|
private static final String compiler = System.getProperty("sun.management.compiler");
|
||||||
|
private static final String vmInfo = System.getProperty("java.vm.info");
|
||||||
|
|
||||||
public static boolean isClient() {
|
public static boolean isClient() {
|
||||||
return vmName.endsWith(" Client VM");
|
return vmName.endsWith(" Client VM");
|
||||||
@ -63,6 +64,18 @@ public class Platform {
|
|||||||
return compiler.contains("Tiered Compilers");
|
return compiler.contains("Tiered Compilers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isInt() {
|
||||||
|
return vmInfo.contains("interpreted");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isMixed() {
|
||||||
|
return vmInfo.contains("mixed");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isComp() {
|
||||||
|
return vmInfo.contains("compiled");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean is32bit() {
|
public static boolean is32bit() {
|
||||||
return dataModel.equals("32");
|
return dataModel.equals("32");
|
||||||
}
|
}
|
||||||
@ -135,12 +148,6 @@ public class Platform {
|
|||||||
return isArch("aarch64");
|
return isArch("aarch64");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isArch(String archnameRE) {
|
|
||||||
return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
|
|
||||||
.matcher(osArch)
|
|
||||||
.matches();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getOsArch() {
|
public static String getOsArch() {
|
||||||
return osArch;
|
return osArch;
|
||||||
}
|
}
|
||||||
@ -203,4 +210,10 @@ public class Platform {
|
|||||||
public static boolean canAttachOSX() throws Exception {
|
public static boolean canAttachOSX() throws Exception {
|
||||||
return userName.equals("root");
|
return userName.equals("root");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isArch(String archnameRE) {
|
||||||
|
return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
|
||||||
|
.matcher(osArch)
|
||||||
|
.matches();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user