From 5443eb560cbf7baf3de56a918cab254c6dd329df Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 6 Nov 2020 17:05:48 +0000 Subject: [PATCH] JAL-3609 formatting save after cherry-picks --- .../src/main/java/jalview/bin/MemorySetting.java | 92 ++++++++++---------- src/jalview/bin/MemorySetting.java | 92 ++++++++++---------- 2 files changed, 92 insertions(+), 92 deletions(-) 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 159374a..5d7f14c 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 @@ -41,9 +41,9 @@ public class MemorySetting private static final long GIGABYTE = 1073741824; // 1GB - public static final long LEAVE_FREE_MIN_MEMORY = GIGABYTE/2; + public static final long LEAVE_FREE_MIN_MEMORY = GIGABYTE / 2; - public static final long APPLICATION_MIN_MEMORY = GIGABYTE/2; + public static final long APPLICATION_MIN_MEMORY = GIGABYTE / 2; private static final long MAX_HEAPSIZE_GB_DEFAULT = 32; @@ -61,28 +61,27 @@ public class MemorySetting * values: jvmmempc - the maximum percentage of total physical memory to * allocate, and jvmmemmax - the maximum absolute amount of physical memory to * allocate. These can be provided as arguments. If not provided as arguments - * (or set as null) system properties will be used instead (if set). The memory - * setting returned will be the lower of the two values. If either of the values - * are not provided then defaults will be used (jvmmempc=90, jvmmemmax=32GB). If - * total physical memory can't be ascertained when jvmmempc was set or neither - * jvmmempc nor jvmmemmax were set, then jvmmemmax defaults to a much safer 8GB. - * In this case explicitly setting jvmmemmax and not setting jvmmempc can set a - * higher memory for Jalview. The calculation also tries to ensure 0.5GB memory - * for the OS, but also tries to ensure at least 0.5GB memory for Jalview (which - * takes priority over the OS) If there is less then 0.5GB of physical memory - * then the total physical memory is used for Jalview. + * (or set as null) system properties will be used instead (if set). The + * memory setting returned will be the lower of the two values. If either of + * the values are not provided then defaults will be used (jvmmempc=90, + * jvmmemmax=32GB). If total physical memory can't be ascertained when + * jvmmempc was set or neither jvmmempc nor jvmmemmax were set, then jvmmemmax + * defaults to a much safer 8GB. In this case explicitly setting jvmmemmax and + * not setting jvmmempc can set a higher memory for Jalview. The calculation + * also tries to ensure 0.5GB memory for the OS, but also tries to ensure at + * least 0.5GB memory for Jalview (which takes priority over the OS) If there + * is less then 0.5GB of physical memory then the total physical memory is + * used for Jalview. * * @param jvmmemmaxarg - * Maximum value of memory to set. This can be a numeric - * string optionally followed by "b", "k", "m", "g", "t" - * (case insensitive) to indicate bytes, kilobytes, - * megabytes, gigabytes, terabytes respectively. If null a - * default value of 32G will be used. If null and either - * physical memory can't be determined then the default is - * 8GB. + * Maximum value of memory to set. This can be a numeric string + * optionally followed by "b", "k", "m", "g", "t" (case insensitive) + * to indicate bytes, kilobytes, megabytes, gigabytes, terabytes + * respectively. If null a default value of 32G will be used. If null + * and either physical memory can't be determined then the default is + * 8GB. * @param jvmmempcarg - * Max percentage of physical memory to use. Defaults to - * "90". + * Max percentage of physical memory to use. Defaults to "90". * * @return The amount of memory (in bytes) to allocate to Jalview */ @@ -136,9 +135,8 @@ public class MemorySetting { memmax = MAX_HEAPSIZE_GB_DEFAULT * GIGABYTE; System.out.println("MemorySetting Property '" - + MAX_HEAPSIZE_PROPERTY_NAME - + "' (" - + jvmmemmaxarg + "') badly formatted, using default (" + + MAX_HEAPSIZE_PROPERTY_NAME + "' (" + jvmmemmaxarg + + "') badly formatted, using default (" + MAX_HEAPSIZE_GB_DEFAULT + "g)."); } @@ -146,11 +144,10 @@ public class MemorySetting if (Long.MAX_VALUE / memmax < multiplier) { memmax = MAX_HEAPSIZE_GB_DEFAULT * GIGABYTE; - System.out.println( - "MemorySetting Property '" + MAX_HEAPSIZE_PROPERTY_NAME + "' (" - + jvmmemmaxarg - + ") too big, using default (" - + MAX_HEAPSIZE_GB_DEFAULT + "g)."); + System.out.println("MemorySetting Property '" + + MAX_HEAPSIZE_PROPERTY_NAME + "' (" + jvmmemmaxarg + + ") too big, using default (" + MAX_HEAPSIZE_GB_DEFAULT + + "g)."); } else { @@ -161,11 +158,10 @@ public class MemorySetting if (memmax < APPLICATION_MIN_MEMORY) { memmax = APPLICATION_MIN_MEMORY; - System.out.println( - "MemorySetting Property '" + MAX_HEAPSIZE_PROPERTY_NAME + "' (" - + jvmmemmaxarg - + ") too small, using minimum (" - + APPLICATION_MIN_MEMORY + ")."); + System.out.println("MemorySetting Property '" + + MAX_HEAPSIZE_PROPERTY_NAME + "' (" + jvmmemmaxarg + + ") too small, using minimum (" + APPLICATION_MIN_MEMORY + + ")."); } } @@ -196,18 +192,17 @@ public class MemorySetting } else { - System.out.println( - "MemorySetting Property '" - + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME - + "' should be in range 1..100. Using default " - + percent + "%"); + System.out.println("MemorySetting Property '" + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + + "' should be in range 1..100. Using default " + percent + + "%"); } } } catch (NumberFormatException e) { - System.out.println( - "MemorySetting property '" + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME - + "' (" + jvmmempcarg + ") badly formatted"); + System.out.println("MemorySetting property '" + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "' (" + jvmmempcarg + + ") badly formatted"); } // catch everything in case of no com.sun.management.OperatingSystemMXBean @@ -246,9 +241,9 @@ public class MemorySetting else { System.out.println("MemorySetting Property '" - + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "' (" + jvmmempcarg - + ") too small. Using minimum (" + APPLICATION_MIN_MEMORY - + ")."); + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "' (" + + jvmmempcarg + ") too small. Using minimum (" + + APPLICATION_MIN_MEMORY + ")."); } mempc = APPLICATION_MIN_MEMORY; } @@ -277,7 +272,12 @@ public class MemorySetting // jvmmempc was set OR neither jvmmempc nor jvmmemmax were set), let's cap // maxMemLong to 8GB if (memoryPercentError && mempc == -1 - && !(jvmmempcarg == null && jvmmemmaxarg != null) // the same as (jvmmempcarg != null || (jvmmempcarg == null && jvmmemmaxarg + && !(jvmmempcarg == null && jvmmemmaxarg != null) // the same as + // (jvmmempcarg != + // null || + // (jvmmempcarg == + // null && + // jvmmemmaxarg // == null)) && memmax > NOMEM_MAX_HEAPSIZE_GB_DEFAULT * GIGABYTE) { diff --git a/src/jalview/bin/MemorySetting.java b/src/jalview/bin/MemorySetting.java index 159374a..5d7f14c 100644 --- a/src/jalview/bin/MemorySetting.java +++ b/src/jalview/bin/MemorySetting.java @@ -41,9 +41,9 @@ public class MemorySetting private static final long GIGABYTE = 1073741824; // 1GB - public static final long LEAVE_FREE_MIN_MEMORY = GIGABYTE/2; + public static final long LEAVE_FREE_MIN_MEMORY = GIGABYTE / 2; - public static final long APPLICATION_MIN_MEMORY = GIGABYTE/2; + public static final long APPLICATION_MIN_MEMORY = GIGABYTE / 2; private static final long MAX_HEAPSIZE_GB_DEFAULT = 32; @@ -61,28 +61,27 @@ public class MemorySetting * values: jvmmempc - the maximum percentage of total physical memory to * allocate, and jvmmemmax - the maximum absolute amount of physical memory to * allocate. These can be provided as arguments. If not provided as arguments - * (or set as null) system properties will be used instead (if set). The memory - * setting returned will be the lower of the two values. If either of the values - * are not provided then defaults will be used (jvmmempc=90, jvmmemmax=32GB). If - * total physical memory can't be ascertained when jvmmempc was set or neither - * jvmmempc nor jvmmemmax were set, then jvmmemmax defaults to a much safer 8GB. - * In this case explicitly setting jvmmemmax and not setting jvmmempc can set a - * higher memory for Jalview. The calculation also tries to ensure 0.5GB memory - * for the OS, but also tries to ensure at least 0.5GB memory for Jalview (which - * takes priority over the OS) If there is less then 0.5GB of physical memory - * then the total physical memory is used for Jalview. + * (or set as null) system properties will be used instead (if set). The + * memory setting returned will be the lower of the two values. If either of + * the values are not provided then defaults will be used (jvmmempc=90, + * jvmmemmax=32GB). If total physical memory can't be ascertained when + * jvmmempc was set or neither jvmmempc nor jvmmemmax were set, then jvmmemmax + * defaults to a much safer 8GB. In this case explicitly setting jvmmemmax and + * not setting jvmmempc can set a higher memory for Jalview. The calculation + * also tries to ensure 0.5GB memory for the OS, but also tries to ensure at + * least 0.5GB memory for Jalview (which takes priority over the OS) If there + * is less then 0.5GB of physical memory then the total physical memory is + * used for Jalview. * * @param jvmmemmaxarg - * Maximum value of memory to set. This can be a numeric - * string optionally followed by "b", "k", "m", "g", "t" - * (case insensitive) to indicate bytes, kilobytes, - * megabytes, gigabytes, terabytes respectively. If null a - * default value of 32G will be used. If null and either - * physical memory can't be determined then the default is - * 8GB. + * Maximum value of memory to set. This can be a numeric string + * optionally followed by "b", "k", "m", "g", "t" (case insensitive) + * to indicate bytes, kilobytes, megabytes, gigabytes, terabytes + * respectively. If null a default value of 32G will be used. If null + * and either physical memory can't be determined then the default is + * 8GB. * @param jvmmempcarg - * Max percentage of physical memory to use. Defaults to - * "90". + * Max percentage of physical memory to use. Defaults to "90". * * @return The amount of memory (in bytes) to allocate to Jalview */ @@ -136,9 +135,8 @@ public class MemorySetting { memmax = MAX_HEAPSIZE_GB_DEFAULT * GIGABYTE; System.out.println("MemorySetting Property '" - + MAX_HEAPSIZE_PROPERTY_NAME - + "' (" - + jvmmemmaxarg + "') badly formatted, using default (" + + MAX_HEAPSIZE_PROPERTY_NAME + "' (" + jvmmemmaxarg + + "') badly formatted, using default (" + MAX_HEAPSIZE_GB_DEFAULT + "g)."); } @@ -146,11 +144,10 @@ public class MemorySetting if (Long.MAX_VALUE / memmax < multiplier) { memmax = MAX_HEAPSIZE_GB_DEFAULT * GIGABYTE; - System.out.println( - "MemorySetting Property '" + MAX_HEAPSIZE_PROPERTY_NAME + "' (" - + jvmmemmaxarg - + ") too big, using default (" - + MAX_HEAPSIZE_GB_DEFAULT + "g)."); + System.out.println("MemorySetting Property '" + + MAX_HEAPSIZE_PROPERTY_NAME + "' (" + jvmmemmaxarg + + ") too big, using default (" + MAX_HEAPSIZE_GB_DEFAULT + + "g)."); } else { @@ -161,11 +158,10 @@ public class MemorySetting if (memmax < APPLICATION_MIN_MEMORY) { memmax = APPLICATION_MIN_MEMORY; - System.out.println( - "MemorySetting Property '" + MAX_HEAPSIZE_PROPERTY_NAME + "' (" - + jvmmemmaxarg - + ") too small, using minimum (" - + APPLICATION_MIN_MEMORY + ")."); + System.out.println("MemorySetting Property '" + + MAX_HEAPSIZE_PROPERTY_NAME + "' (" + jvmmemmaxarg + + ") too small, using minimum (" + APPLICATION_MIN_MEMORY + + ")."); } } @@ -196,18 +192,17 @@ public class MemorySetting } else { - System.out.println( - "MemorySetting Property '" - + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME - + "' should be in range 1..100. Using default " - + percent + "%"); + System.out.println("MemorySetting Property '" + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + + "' should be in range 1..100. Using default " + percent + + "%"); } } } catch (NumberFormatException e) { - System.out.println( - "MemorySetting property '" + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME - + "' (" + jvmmempcarg + ") badly formatted"); + System.out.println("MemorySetting property '" + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "' (" + jvmmempcarg + + ") badly formatted"); } // catch everything in case of no com.sun.management.OperatingSystemMXBean @@ -246,9 +241,9 @@ public class MemorySetting else { System.out.println("MemorySetting Property '" - + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "' (" + jvmmempcarg - + ") too small. Using minimum (" + APPLICATION_MIN_MEMORY - + ")."); + + MAX_HEAPSIZE_PERCENT_PROPERTY_NAME + "' (" + + jvmmempcarg + ") too small. Using minimum (" + + APPLICATION_MIN_MEMORY + ")."); } mempc = APPLICATION_MIN_MEMORY; } @@ -277,7 +272,12 @@ public class MemorySetting // jvmmempc was set OR neither jvmmempc nor jvmmemmax were set), let's cap // maxMemLong to 8GB if (memoryPercentError && mempc == -1 - && !(jvmmempcarg == null && jvmmemmaxarg != null) // the same as (jvmmempcarg != null || (jvmmempcarg == null && jvmmemmaxarg + && !(jvmmempcarg == null && jvmmemmaxarg != null) // the same as + // (jvmmempcarg != + // null || + // (jvmmempcarg == + // null && + // jvmmemmaxarg // == null)) && memmax > NOMEM_MAX_HEAPSIZE_GB_DEFAULT * GIGABYTE) { -- 1.7.10.2