Setting a default constant value inside a private function that is invoked with different keys at different places in the code is not a good idea. It can be set in Constants.java similar to DEFAULT_YARN_SCHEDULER_MIN_MB .
Also the next if for memoryMb == 0L needs to be updated/removed accordingly.