JAL-3477 New sensible default decisions on memory, and new jvmmemmax setting for...
[jalview.git] / src / jalview / bin / Launcher.java
index 412f119..041a7b1 100644 (file)
@@ -7,13 +7,8 @@ import java.util.ArrayList;
 
 public class Launcher
 {
-
   private final static String startClass = "jalview.bin.Jalview";
 
-  private final static int maxHeapSizePerCent = 90;
-
-  private final static String maxHeapSizePerCentProperty = "jvmmempc";
-
   private final static String dockIconPath = "JalviewLogo_Huge.png";
 
   public static void main(String[] args)
@@ -65,41 +60,8 @@ public class Launcher
 
     if (!memSet)
     {
-      long maxMemLong = -1;
-      int percent = maxHeapSizePerCent;
-      String jvmmempc = System.getProperty(maxHeapSizePerCentProperty);
-      try
-      {
-        if (jvmmempc != null)
-        {
-          int trypercent = Integer.parseInt(jvmmempc);
-          if (0 < trypercent && trypercent <= 100)
-          {
-            percent = trypercent;
-          }
-          else
-          {
-            System.out.println("Property '" + maxHeapSizePerCentProperty
-                    + "' should be in range 1..100");
-          }
-        }
-      } catch (Exception e)
-      {
-        System.out.println("Error parsing " + maxHeapSizePerCentProperty
-                + " '" + jvmmempc + "'");
-      }
-
-      try
-      {
-        maxMemLong = MemorySetting.memPercent(percent);
-      } catch (Exception e)
-      {
-        e.printStackTrace();
-      } catch (Throwable t)
-      {
-        t.printStackTrace();
-      }
-
+      long maxMemLong = MemorySetting.getMemorySetting();
+      
       if (maxMemLong > 0)
       {
         memSetting = "-Xmx" + Long.toString(maxMemLong);
@@ -130,6 +92,11 @@ public class Launcher
     System.out.println("Running " + startClass + " with "
             + (memSetting == null ? "no memSetting" : memSetting));
 
+    if (System.getProperty("launcherstop") != null
+            && System.getProperty("launcherstop").equals("true"))
+    {
+      System.exit(0);
+    }
     try
     {
       builder.inheritIO();