From: Ben Soares Date: Tue, 19 Nov 2019 20:23:32 +0000 (+0000) Subject: JAL-3210 removing overly complicated logging. Settling for System.out.println and... X-Git-Tag: Develop-2_11_2_0-d20201215~88^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=205ff41c5d14efc1e79f362aee27ca40fbc801bd;p=jalview.git JAL-3210 removing overly complicated logging. Settling for System.out.println and System.err.println for MemorySetting output --- diff --git a/getdown/lib/getdown-core.jar b/getdown/lib/getdown-core.jar index 1d6b83c..dfaa6e6 100644 Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ diff --git a/getdown/lib/getdown-launcher-local.jar b/getdown/lib/getdown-launcher-local.jar index 50faf1b..82e1a2d 100644 Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ diff --git a/getdown/lib/getdown-launcher.jar b/getdown/lib/getdown-launcher.jar index 077c2c4..d395991 100644 Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ diff --git a/getdown/src/getdown/ant/pom.xml b/getdown/src/getdown/ant/pom.xml index 5a2352b..13b77c6 100644 --- a/getdown/src/getdown/ant/pom.xml +++ b/getdown/src/getdown/ant/pom.xml @@ -4,7 +4,7 @@ com.threerings.getdown getdown - 1.8.3-1.2.0_FJVL + 1.8.3-1.2.1_FJVL getdown-ant diff --git a/getdown/src/getdown/core/pom.xml b/getdown/src/getdown/core/pom.xml index c5d3b2d..590d5da 100644 --- a/getdown/src/getdown/core/pom.xml +++ b/getdown/src/getdown/core/pom.xml @@ -4,7 +4,7 @@ com.threerings.getdown getdown - 1.8.3-1.2.0_FJVL + 1.8.3-1.2.1_FJVL getdown-core diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java b/getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java index 2de2157..90257d1 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java @@ -21,33 +21,47 @@ public class MemoryPercent } catch (NoClassDefFoundError e) { // com.sun.management.OperatingSystemMXBean doesn't exist in this JVM - System.out.println("No com.sun.management.OperatingSystemMXBean"); + System.err.println( + "No com.sun.management.OperatingSystemMXBean: cannot get total physical memory size"); } // We didn't get a com.sun.management.OperatingSystemMXBean. return -1; } - public static long memPercent(int percent) + public static long memPercentAmount(int percent) { - return memPercent(percent); + return memPercentAmount((float)percent); } - public static long memPercent(float percent) + public static long memPercentAmount(float percent) { - long memPercent = -1; + long memPercentAmount = -1; long physicalMem = getPhysicalMemory(); if (physicalMem > MemorySetting.applicationMinMemory) { // try and set at least applicationMinMemory and thereafter ensure // leaveFreeMinMemory is left for the OS - memPercent = Math.max(MemorySetting.applicationMinMemory, - (long) (physicalMem - - Math.max(physicalMem * (100 - percent) / 100, - MemorySetting.leaveFreeMinMemory))); + + memPercentAmount = (long) ((physicalMem * percent) / 100F); + + // check for memory left for OS + if (physicalMem - memPercentAmount < MemorySetting.leaveFreeMinMemory) + { + memPercentAmount = physicalMem - MemorySetting.leaveFreeMinMemory; + } + + // check for minimum application memsize + if (memPercentAmount < MemorySetting.applicationMinMemory) + { + memPercentAmount = MemorySetting.applicationMinMemory; + } + } else { + // not enough memory for application, just try and grab what we can! + memPercentAmount = physicalMem; } - return memPercent; + return memPercentAmount; } } diff --git a/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java b/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java index ac1ac28..561fea5 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java +++ b/getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java @@ -16,6 +16,8 @@ public class MemorySetting public final static String maxHeapSizeProperty = "jvmmemmax"; + protected static boolean logToClassChecked = false; + public static long getMemorySetting() { return getMemorySetting(null, null); @@ -71,7 +73,8 @@ public class MemorySetting } catch (NumberFormatException e) { memmax = maxHeapSizeDefault; - System.out.println("MemorySetting Property '" + maxHeapSizeProperty + System.out.println("MemorySetting Property '" + + maxHeapSizeProperty + "' (" + jvmmemmaxorig + "') badly formatted, using default (" + memmax + ")."); @@ -105,7 +108,8 @@ public class MemorySetting else { // no need to warn if no setting - // System.out.println("MemorySetting Property '" + maxHeapSizeProperty + "' not + // System.out.println("MemorySetting Property '" + maxHeapSizeProperty + // + "' not // set."); } @@ -144,7 +148,7 @@ public class MemorySetting boolean memoryPercentError = false; try { - pcmem = MemoryPercent.memPercent(percent); + pcmem = MemoryPercent.memPercentAmount(percent); } catch (Throwable t) { memoryPercentError = true; @@ -153,7 +157,7 @@ public class MemorySetting + "). Likely to be problem with com.sun.management.OperatingSystemMXBean"); t.printStackTrace(); } - // In the case of an error reading the percentage if physical memory, let's cap maxMemLong to 8GB + // In the case of an error reading the percentage of physical memory (when jvmmempc was set), let's cap maxMemLong to 8GB if (memoryPercentError && jvmmempc != null && pcmem == -1 && memmax > noMemMaxHeapSizeDefault) { diff --git a/getdown/src/getdown/launcher/pom.xml b/getdown/src/getdown/launcher/pom.xml index 7c86a9f..1610211 100644 --- a/getdown/src/getdown/launcher/pom.xml +++ b/getdown/src/getdown/launcher/pom.xml @@ -4,7 +4,7 @@ com.threerings.getdown getdown - 1.8.3-1.2.0_FJVL + 1.8.3-1.2.1_FJVL getdown-launcher diff --git a/getdown/src/getdown/mvn_cmd b/getdown/src/getdown/mvn_cmd index a70deeb..e9e6c32 100755 --- a/getdown/src/getdown/mvn_cmd +++ b/getdown/src/getdown/mvn_cmd @@ -3,7 +3,7 @@ if [ x$JVLVERSION != x ]; then export VERSION=$JVLVERSION else - export VERSION=1.8.3-1.2.0_JVL + export VERSION=1.8.3-1.2.1_JVL fi if [ x${VERSION%_JVL} = x$VERSION ]; then diff --git a/getdown/src/getdown/pom.xml b/getdown/src/getdown/pom.xml index 238eac9..84411af 100644 --- a/getdown/src/getdown/pom.xml +++ b/getdown/src/getdown/pom.xml @@ -10,7 +10,7 @@ com.threerings.getdown getdown pom - 1.8.3-1.2.0_FJVL + 1.8.3-1.2.1_FJVL getdown An application installer and updater. diff --git a/gradle.properties b/gradle.properties index 3d74a81..cda2658 100644 --- a/gradle.properties +++ b/gradle.properties @@ -62,8 +62,9 @@ getdown_build_properties = build_properties getdown_txt_title = Jalview getdown_txt_allow_offline = true getdown_txt_max_concurrent_downloads = 10 -getdown_txt_jalview.jvmmempc = 90 -getdown_txt_jalview.jvmmemmax = 32G +# now got better defaults when not set +getdown_txt_jalview.jvmmempc = 900 +#getdown_txt_jalview.jvmmemmax = 32G # now got better defaults when not set getdown_txt_multi_jvmarg = -Dgetdownappdir=%APPDIR% getdown_txt_strict_comments = true getdown_txt_title = Jalview diff --git a/j11lib/getdown-core.jar b/j11lib/getdown-core.jar index 1d6b83c..dfaa6e6 100644 Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ diff --git a/j8lib/getdown-core.jar b/j8lib/getdown-core.jar index 1d6b83c..dfaa6e6 100644 Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ diff --git a/src/jalview/bin/MemoryPercent.java b/src/jalview/bin/MemoryPercent.java index 2de2157..90257d1 100644 --- a/src/jalview/bin/MemoryPercent.java +++ b/src/jalview/bin/MemoryPercent.java @@ -21,33 +21,47 @@ public class MemoryPercent } catch (NoClassDefFoundError e) { // com.sun.management.OperatingSystemMXBean doesn't exist in this JVM - System.out.println("No com.sun.management.OperatingSystemMXBean"); + System.err.println( + "No com.sun.management.OperatingSystemMXBean: cannot get total physical memory size"); } // We didn't get a com.sun.management.OperatingSystemMXBean. return -1; } - public static long memPercent(int percent) + public static long memPercentAmount(int percent) { - return memPercent(percent); + return memPercentAmount((float)percent); } - public static long memPercent(float percent) + public static long memPercentAmount(float percent) { - long memPercent = -1; + long memPercentAmount = -1; long physicalMem = getPhysicalMemory(); if (physicalMem > MemorySetting.applicationMinMemory) { // try and set at least applicationMinMemory and thereafter ensure // leaveFreeMinMemory is left for the OS - memPercent = Math.max(MemorySetting.applicationMinMemory, - (long) (physicalMem - - Math.max(physicalMem * (100 - percent) / 100, - MemorySetting.leaveFreeMinMemory))); + + memPercentAmount = (long) ((physicalMem * percent) / 100F); + + // check for memory left for OS + if (physicalMem - memPercentAmount < MemorySetting.leaveFreeMinMemory) + { + memPercentAmount = physicalMem - MemorySetting.leaveFreeMinMemory; + } + + // check for minimum application memsize + if (memPercentAmount < MemorySetting.applicationMinMemory) + { + memPercentAmount = MemorySetting.applicationMinMemory; + } + } else { + // not enough memory for application, just try and grab what we can! + memPercentAmount = physicalMem; } - return memPercent; + return memPercentAmount; } } diff --git a/src/jalview/bin/MemorySetting.java b/src/jalview/bin/MemorySetting.java index ac1ac28..561fea5 100644 --- a/src/jalview/bin/MemorySetting.java +++ b/src/jalview/bin/MemorySetting.java @@ -16,6 +16,8 @@ public class MemorySetting public final static String maxHeapSizeProperty = "jvmmemmax"; + protected static boolean logToClassChecked = false; + public static long getMemorySetting() { return getMemorySetting(null, null); @@ -71,7 +73,8 @@ public class MemorySetting } catch (NumberFormatException e) { memmax = maxHeapSizeDefault; - System.out.println("MemorySetting Property '" + maxHeapSizeProperty + System.out.println("MemorySetting Property '" + + maxHeapSizeProperty + "' (" + jvmmemmaxorig + "') badly formatted, using default (" + memmax + ")."); @@ -105,7 +108,8 @@ public class MemorySetting else { // no need to warn if no setting - // System.out.println("MemorySetting Property '" + maxHeapSizeProperty + "' not + // System.out.println("MemorySetting Property '" + maxHeapSizeProperty + // + "' not // set."); } @@ -144,7 +148,7 @@ public class MemorySetting boolean memoryPercentError = false; try { - pcmem = MemoryPercent.memPercent(percent); + pcmem = MemoryPercent.memPercentAmount(percent); } catch (Throwable t) { memoryPercentError = true; @@ -153,7 +157,7 @@ public class MemorySetting + "). Likely to be problem with com.sun.management.OperatingSystemMXBean"); t.printStackTrace(); } - // In the case of an error reading the percentage if physical memory, let's cap maxMemLong to 8GB + // In the case of an error reading the percentage of physical memory (when jvmmempc was set), let's cap maxMemLong to 8GB if (memoryPercentError && jvmmempc != null && pcmem == -1 && memmax > noMemMaxHeapSizeDefault) {