JAL-3210 removing overly complicated logging. Settling for System.out.println and...
authorBen Soares <bsoares@dundee.ac.uk>
Tue, 19 Nov 2019 20:23:32 +0000 (20:23 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Tue, 19 Nov 2019 20:23:32 +0000 (20:23 +0000)
15 files changed:
getdown/lib/getdown-core.jar
getdown/lib/getdown-launcher-local.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/ant/pom.xml
getdown/src/getdown/core/pom.xml
getdown/src/getdown/core/src/main/java/jalview/bin/MemoryPercent.java
getdown/src/getdown/core/src/main/java/jalview/bin/MemorySetting.java
getdown/src/getdown/launcher/pom.xml
getdown/src/getdown/mvn_cmd
getdown/src/getdown/pom.xml
gradle.properties
j11lib/getdown-core.jar
j8lib/getdown-core.jar
src/jalview/bin/MemoryPercent.java
src/jalview/bin/MemorySetting.java

index 1d6b83c..dfaa6e6 100644 (file)
Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ
index 50faf1b..82e1a2d 100644 (file)
Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ
index 077c2c4..d395991 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index 5a2352b..13b77c6 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.2.0_FJVL</version>
+    <version>1.8.3-1.2.1_FJVL</version>
   </parent>
 
   <artifactId>getdown-ant</artifactId>
index c5d3b2d..590d5da 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.2.0_FJVL</version>
+    <version>1.8.3-1.2.1_FJVL</version>
   </parent>
 
   <artifactId>getdown-core</artifactId>
index 2de2157..90257d1 100644 (file)
@@ -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;
   }
 
 }
index ac1ac28..561fea5 100644 (file)
@@ -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)
     {
index 7c86a9f..1610211 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.2.0_FJVL</version>
+    <version>1.8.3-1.2.1_FJVL</version>
   </parent>
 
   <artifactId>getdown-launcher</artifactId>
index a70deeb..e9e6c32 100755 (executable)
@@ -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
index 238eac9..84411af 100644 (file)
@@ -10,7 +10,7 @@
   <groupId>com.threerings.getdown</groupId>
   <artifactId>getdown</artifactId>
   <packaging>pom</packaging>
-  <version>1.8.3-1.2.0_FJVL</version>
+  <version>1.8.3-1.2.1_FJVL</version>
 
   <name>getdown</name>
   <description>An application installer and updater.</description>
index 3d74a81..cda2658 100644 (file)
@@ -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
index 1d6b83c..dfaa6e6 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
index 1d6b83c..dfaa6e6 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ
index 2de2157..90257d1 100644 (file)
@@ -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;
   }
 
 }
index ac1ac28..561fea5 100644 (file)
@@ -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)
     {