accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubbsii <...@git.apache.org>
Subject [GitHub] accumulo pull request #236: ACCUMULO-4614 AccumuloClassLoader should load ac...
Date Tue, 28 Mar 2017 22:32:50 GMT
Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/236#discussion_r108553471
  
    --- Diff: start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
---
    @@ -44,21 +44,21 @@
     
     public class AccumuloClassLoader {
     
    -  public static final String CLASSPATH_PROPERTY_NAME = "general.classpaths";
    +  public static final String GENERAL_CLASSPATHS = "general.classpaths";
       public static final String MAVEN_PROJECT_BASEDIR_PROPERTY_NAME = "general.maven.project.basedir";
       public static final String DEFAULT_MAVEN_PROJECT_BASEDIR_VALUE = "";
     
    -  private static String SITE_CONF;
    +  private static URL accumuloConfigUrl;
       private static URLClassLoader classloader;
       private static final Logger log = LoggerFactory.getLogger(AccumuloClassLoader.class);
     
       static {
    -    String configFile = System.getProperty("org.apache.accumulo.config.file", "accumulo-site.xml");
    -    if (System.getenv("ACCUMULO_CONF_DIR") != null) {
    -      // accumulo conf dir should be set
    -      SITE_CONF = System.getenv("ACCUMULO_CONF_DIR") + "/" + configFile;
    +    String configFilename = System.getProperty("org.apache.accumulo.config.file", "accumulo-site.xml");
    +    accumuloConfigUrl = AccumuloClassLoader.class.getClassLoader().getResource(configFilename);
    +    if (accumuloConfigUrl == null) {
    +      log.warn("Failed to load Accumulo configuration '{}' from classpath", configFilename);
    --- End diff --
    
    @mikewalch  It sounds like you're suggesting that the only reason to offer both is because
a user might have poor configuration management practices, resulting in unexpected configuration
changes. For such a user, one could say that the contents of the file at the given absolute
path are just as likely to change unexpectedly.
    
    As long as the file URI scheme works correctly, I won't veto it or anything. But, I do
think the argument in favor of it is somewhat weak. I also have some concerns that it might
set a bad precedent. By supporting both, are we setting ourselves up to ensure that we support
both mechanisms for all future configs, (metrics, client configs, etc.), for consistency?
    
    It's unfortunate that log4j doesn't ship its configuration loading strategy as a separate
component that we could reuse. If they did, we could just use that for all configuration file
loading, and get consistency across the board with minimal code to maintain.


---
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