--- old/src/java.base/share/classes/sun/launcher/LauncherHelper.java 2020-02-18 11:57:33.969719673 +0100 +++ new/src/java.base/share/classes/sun/launcher/LauncherHelper.java 2020-02-18 11:57:33.833719424 +0100 @@ -119,7 +119,7 @@ private static final String defaultBundleName = "sun.launcher.resources.launcher"; - private static final long LONG_RETVAL_NOT_SUPPORTED = -2; + private static class ResourceBundleHolder { private static final ResourceBundle RB = ResourceBundle.getBundle(defaultBundleName); @@ -324,11 +324,13 @@ return; } + final long longRetvalNotSupported = -2; + ostream.println(INDENT + "Provider: " + c.getProvider()); ostream.println(INDENT + "Effective CPU Count: " + c.getEffectiveCpuCount()); - ostream.println(formatCpuVal(c.getCpuPeriod(), INDENT + "CPU Period: ")); - ostream.println(formatCpuVal(c.getCpuQuota(), INDENT + "CPU Quota: ")); - ostream.println(formatCpuVal(c.getCpuShares(), INDENT + "CPU Shares: ")); + ostream.println(formatCpuVal(c.getCpuPeriod(), INDENT + "CPU Period: ", longRetvalNotSupported)); + ostream.println(formatCpuVal(c.getCpuQuota(), INDENT + "CPU Quota: ", longRetvalNotSupported)); + ostream.println(formatCpuVal(c.getCpuShares(), INDENT + "CPU Shares: ", longRetvalNotSupported)); int cpus[] = c.getCpuSetCpus(); if (cpus != null) { @@ -395,45 +397,37 @@ } long limit = c.getMemoryLimit(); - ostream.println(formatLimitString(limit, INDENT + "Memory Limit: ")); + ostream.println(formatLimitString(limit, INDENT + "Memory Limit: ", longRetvalNotSupported)); limit = c.getMemorySoftLimit(); - ostream.println(formatLimitString(limit, INDENT + "Memory Soft Limit: ")); + ostream.println(formatLimitString(limit, INDENT + "Memory Soft Limit: ", longRetvalNotSupported)); limit = c.getMemoryAndSwapLimit(); - ostream.println(formatLimitString(limit, INDENT + "Memory & Swap Limit: ")); + ostream.println(formatLimitString(limit, INDENT + "Memory & Swap Limit: ", longRetvalNotSupported)); ostream.println(""); } - private static String formatLimitString(long limit, String prefix) { + private static String formatLimitString(long limit, String prefix, long unavailable) { if (limit >= 0) { return prefix + SizePrefix.scaleValue(limit); - } else if (limit == LONG_RETVAL_NOT_SUPPORTED) { + } else if (limit == unavailable) { return prefix + "N/A"; } else { return prefix + "Unlimited"; } } - private static String formatCpuVal(long cpuVal, String prefix) { + private static String formatCpuVal(long cpuVal, String prefix, long unavailable) { if (cpuVal >= 0) { return prefix + cpuVal + "us"; - } else if (cpuVal == LONG_RETVAL_NOT_SUPPORTED) { + } else if (cpuVal == unavailable) { return prefix + "N/A"; } else { return prefix + cpuVal; } } - private static String formatBoolean(Boolean value, String prefix) { - if (value != null) { - return prefix + value; - } else { - return prefix + "N/A"; - } - } - private enum SizePrefix { KILO(1024, "K"),