Github user anew commented on a diff in the pull request:

    https://github.com/apache/twill/pull/59#discussion_r131708600
  
    --- Diff: 
twill-core/src/main/java/org/apache/twill/internal/TwillRuntimeSpecification.java
 ---
    @@ -171,9 +168,27 @@ public String getKafkaZKConnect() {
       /**
        * Returns the minimum heap ratio ({@link 
Configs.Keys#HEAP_RESERVED_MIN_RATIO}) based on the given configuration.
        */
    -  private double getMinHeapRatio(Map<String, String> config) {
    -    return config.containsKey(Configs.Keys.HEAP_RESERVED_MIN_RATIO) ?
    -      Double.parseDouble(config.get(Configs.Keys.HEAP_RESERVED_MIN_RATIO)) 
:
    -      Configs.Defaults.HEAP_RESERVED_MIN_RATIO;
    +  private double getMinHeapRatio(@Nullable Map<String, String> config, 
double defaultValue) {
    +    if (config == null) {
    +      return defaultValue;
    +    }
    +
    +    double ratio = 
config.containsKey(Configs.Keys.HEAP_RESERVED_MIN_RATIO) ?
    +      Double.parseDouble(config.get(Configs.Keys.HEAP_RESERVED_MIN_RATIO)) 
: defaultValue;
    +    // Ratio can't be <= 0
    +    return ratio <= 0d ? defaultValue : ratio;
    +  }
    +
    +  /**
    +   * Returns the reserved memory size ({@link 
Configs.Keys#HEAP_RESERVED_MIN_RATIO}) based on the given configuration.
    +   */
    +  private int getReservedMemory(@Nullable Map<String, String> config, int 
defaultValue) {
    +    if (config == null) {
    +      return defaultValue;
    --- End diff --
    
    similar to getMinHeapRatio


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to