drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudheeshkatkam <...@git.apache.org>
Subject [GitHub] drill pull request: Enhanced logging and associated code hygiene
Date Wed, 15 Jul 2015 01:43:01 GMT
Github user sudheeshkatkam commented on a diff in the pull request:

    https://github.com/apache/drill/pull/93#discussion_r34639451
  
    --- Diff: common/src/main/java/org/apache/drill/common/config/DrillConfig.java ---
    @@ -138,34 +155,77 @@ public static DrillConfig create(Properties testConfigurations)
{
         return create(null, testConfigurations, true);
       }
     
    -  public static DrillConfig create(String overrideFileName, boolean enableServerConfigs)
{
    -    return create(overrideFileName, null, enableServerConfigs);
    +  /**
    +   * ...
    +   * @param overrideFileResourcePathname
    +   *          see {@link #create(String)}'s {@code overrideFileResourcePathname}
    +   */
    +  public static DrillConfig create(String overrideFileResourcePathname, boolean enableServerConfigs)
{
    +    return create(overrideFileResourcePathname, null, enableServerConfigs);
       }
     
    -  private static DrillConfig create(String overrideFileName, Properties overriderProps,
boolean enableServerConfigs) {
    -    overrideFileName = overrideFileName == null ? CommonConstants.CONFIG_OVERRIDE : overrideFileName;
    -
    -    // first we load defaults.
    +  /**
    +   * ...
    +   * @param overrideFileResourcePathname
    +   *          see {@link #create(String)}'s {@code overrideFileResourcePathname}
    +   * @param overriderProps
    +   *          optional property map for further overriding (after override file
    +   *          is assimilated
    +   * @param enableServerConfigs
    +   *          whether to enable server-specific configuration options
    +   * @return
    +   */
    +  private static DrillConfig create(String overrideFileResourcePathname,
    +                                    final Properties overriderProps,
    +                                    final boolean enableServerConfigs) {
    +    overrideFileResourcePathname =
    +        overrideFileResourcePathname == null
    +            ? CommonConstants.CONFIG_OVERRIDE
    +            : overrideFileResourcePathname;
    +
    +    // 1. Load defaults configuration file.
         Config fallback = null;
         final ClassLoader[] classLoaders = ClasspathHelper.classLoaders();
         for (ClassLoader classLoader : classLoaders) {
    -      if (classLoader.getResource(CommonConstants.CONFIG_DEFAULT) != null) {
    -        fallback = ConfigFactory.load(classLoader, CommonConstants.CONFIG_DEFAULT);
    +      final URL url =
    +          classLoader.getResource(CommonConstants.CONFIG_DEFAULT);
    +      if (null != url) {
    +        logger.debug("Loading base config. file at {}.", url);
    +        fallback =
    +            ConfigFactory.load(classLoader,
    +                               CommonConstants.CONFIG_DEFAULT);
             break;
           }
         }
     
    +    // 2. Load per-module configuration files.
         Collection<URL> urls = PathScanner.getConfigURLs();
         logger.debug("Loading configs at the following URLs {}", urls);
         for (URL url : urls) {
    +      logger.debug("Loading module config. file at {}.", url);
           fallback = ConfigFactory.parseURL(url).withFallback(fallback);
         }
     
    -    Config effectiveConfig = ConfigFactory.load(overrideFileName).withFallback(fallback);
    +    // 3. Load any overrides configuration file and overrides from JVM
    --- End diff --
    
    overrides *from* configuration file


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message