forked from I2P_Developers/i2p.i2p
Console: Add warning for OpenJDK Zero VM
This commit is contained in:
@ -344,8 +344,9 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
boolean noPack200 = (PluginStarter.pluginsEnabled(_context) || !NewsHelper.isUpdateDisabled(_context)) &&
|
||||
!FileUtil.isPack200Supported();
|
||||
boolean openARM = SystemVersion.isARM() && SystemVersion.isOpenJDK() && !SystemVersion.isJava9();
|
||||
boolean isZero = SystemVersion.isZeroVM();
|
||||
boolean isJava11 = false; // SystemVersion.isJava11();
|
||||
if (noJava7 || noPack200 || openARM || isJava11) {
|
||||
if (noJava7 || noPack200 || openARM || isZero || isJava11) {
|
||||
String s = "Java version: " + System.getProperty("java.version") +
|
||||
" OS: " + System.getProperty("os.name") + ' ' +
|
||||
System.getProperty("os.arch") + ' ' +
|
||||
@ -368,6 +369,11 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
log.logAlways(net.i2p.util.Log.WARN, s);
|
||||
System.out.println("Warning: " + s);
|
||||
}
|
||||
if (isZero) {
|
||||
s = "OpenJDK Zero is a very slow interpreter-only JVM. Not recommended for use with I2P. Please use a faster JVM if possible.";
|
||||
log.logAlways(net.i2p.util.Log.WARN, s);
|
||||
System.out.println("Warning: " + s);
|
||||
}
|
||||
//if (isJava11) {
|
||||
// s = "Java 11+ support is beta, and not recommended for general use";
|
||||
// log.logAlways(net.i2p.util.Log.WARN, s);
|
||||
|
@ -33,6 +33,8 @@ public abstract class SystemVersion {
|
||||
System.getProperty("os.arch").equals("amd64");
|
||||
private static final boolean _isGentoo = System.getProperty("os.version").contains("gentoo") ||
|
||||
System.getProperty("os.version").contains("hardened"); // Funtoo
|
||||
// Could also check for java.vm.info = "interpreted mode"
|
||||
private static final boolean _isZero = System.getProperty("java.vm.name").contains("Zero");
|
||||
private static final boolean _isAndroid;
|
||||
private static final boolean _isApache;
|
||||
private static final boolean _isGNU;
|
||||
@ -73,7 +75,7 @@ public abstract class SystemVersion {
|
||||
_isLinuxService = !_isWin && !_isMac && !_isAndroid &&
|
||||
(DAEMON_USER.equals(System.getProperty("user.name")) ||
|
||||
(_isGentoo && GENTOO_USER.equals(System.getProperty("user.name"))));
|
||||
_isSlow = _isAndroid || _isApache || _isArm || _isGNU || getMaxMemory() < 48*1024*1024L;
|
||||
_isSlow = _isAndroid || _isApache || _isArm || _isGNU || _isZero || getMaxMemory() < 48*1024*1024L;
|
||||
|
||||
int sdk = 0;
|
||||
if (_isAndroid) {
|
||||
@ -163,6 +165,14 @@ public abstract class SystemVersion {
|
||||
return _isX86;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a very slow interpreted mode VM?
|
||||
* @since 0.9.38
|
||||
*/
|
||||
public static boolean isZeroVM() {
|
||||
return _isZero;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our best guess on whether this is a slow architecture / OS / JVM,
|
||||
* using some simple heuristics.
|
||||
@ -347,6 +357,6 @@ public abstract class SystemVersion {
|
||||
System.out.println("Windows : " + isWindows());
|
||||
System.out.println("Wrapper : " + hasWrapper());
|
||||
System.out.println("x86 : " + isX86());
|
||||
|
||||
System.out.println("Zero JVM : " + isZeroVM());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user