コード例 #1
0
 @Provides
 @Singleton
 public Configuration provideConfiguration() {
   Configuration configuration = new Configuration();
   configuration.set(StandaloneAndClusterPipelineManager.RUNNER_EXPIRY_INTERVAL, expiry);
   return configuration;
 }
コード例 #2
0
 void loadConfigIncludes() {
   String includes = get(CONFIG_INCLUDES, null);
   if (includes != null) {
     map.remove(CONFIG_INCLUDES);
     for (String include : Splitter.on(",").trimResults().omitEmptyStrings().split(includes)) {
       File file = new File(fileRefsBaseDir, include);
       try (Reader reader = new FileReader(file)) {
         Configuration conf = new Configuration();
         conf.load(reader);
         conf.map.remove(CONFIG_INCLUDES);
         for (Map.Entry<String, Ref> entry : conf.map.entrySet()) {
           map.put(entry.getKey(), entry.getValue());
         }
       } catch (IOException ex) {
         throw new IllegalArgumentException(
             Utils.format(
                 "Include config file '{}' could not be read: {}",
                 file.getAbsolutePath(),
                 ex.toString()));
       }
     }
   }
 }