X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Fmain%2Fjava%2Fjalview%2Fbin%2FGetMemory.java;fp=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Fmain%2Fjava%2Fjalview%2Fbin%2FMemoryPercent.java;h=e89bffbc53d7035a31ed0af4ce90e667e8b92e3a;hb=099c1a986b7a6eaf7606c80d04ef55bd862472f6;hp=3288e66c12854aa4c1aa08f199a6676c25aabddb;hpb=d2b971a3c4d8fa289651b74040cc741b9553a7cb;p=jalview.git diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java b/getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java similarity index 51% rename from getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java rename to getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java index 3288e66..e89bffb 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/GetMemory.java @@ -3,9 +3,29 @@ package jalview.bin; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; -public class MemoryPercent +/** + * Isolated class to ascertain physical memory of the system using + * com.sun.management.OperatingSystemMXBean class's getTotalPhysicalMemorySize + * method. This class is present in OpenJDK 8,9,10,11,12,13. It is present but + * marked as deprecated in the early-access(30) release of OpenJDK 14. In case + * of an alternative/unsupported JRE being used or the class/method not being + * implemented in an exotic architecture JRE this call has been isolated into + * this separate class. + * + * @author bsoares + * + */ +class GetMemory { + /** + * Wrapper for + * com.sun.management.OperatingSystemMXBean.getTotalPhysicalMemorySize() + * + * @return Result of + * com.sun.management.OperatingSystemMXBean.getTotalPhysicalMemorySize() + * or -1 if this class is not present in the JRE. + */ protected static long getPhysicalMemory() { final OperatingSystemMXBean o = ManagementFactory