@Test public void testConfigUnchanged() { Configuration configuration = new Configuration(); ClusterUtil.rubixSiteExists = new AtomicReference<>(); Configuration configuration2 = ClusterUtil.applyRubixSiteConfig(configuration); assertEquals(configuration, configuration2, "Returned config in no config should be unchanged"); }
public static Configuration applyRubixSiteConfig(Configuration conf) { if (CacheConfig.isRubixSiteConfigApplied(conf)) { return conf; } if (rubixSiteExists.get() == null) { synchronized (rubixSiteExists) { if (rubixSiteExists.get() == null) { String configFileLocation = CacheConfig.getRubixSiteLocation(conf); File configFile = new File(configFileLocation); if (configFile.exists() && configFile.isFile() && configFile.length() != 0) { rubixSiteExists.set(true); } else { rubixSiteExists.set(false); } } } } if (rubixSiteExists.get()) { conf.addResource(new Path(CacheConfig.getRubixSiteLocation(conf))); CacheConfig.setRubixConfigApplied(conf, true); } return conf; }
ClusterUtil { public static Configuration applyRubixSiteConfig(Configuration conf) { if (CacheConfig.isRubixSiteConfigApplied(conf)) { return conf; } if (rubixSiteExists.get() == null) { synchronized (rubixSiteExists) { if (rubixSiteExists.get() == null) { String configFileLocation = CacheConfig.getRubixSiteLocation(conf); File configFile = new File(configFileLocation); if (configFile.exists() && configFile.isFile() && configFile.length() != 0) { rubixSiteExists.set(true); } else { rubixSiteExists.set(false); } } } } if (rubixSiteExists.get()) { conf.addResource(new Path(CacheConfig.getRubixSiteLocation(conf))); CacheConfig.setRubixConfigApplied(conf, true); } return conf; } }
ClusterUtil { public static Configuration applyRubixSiteConfig(Configuration conf) { if (CacheConfig.isRubixSiteConfigApplied(conf)) { return conf; } if (rubixSiteExists.get() == null) { synchronized (rubixSiteExists) { if (rubixSiteExists.get() == null) { String configFileLocation = CacheConfig.getRubixSiteLocation(conf); File configFile = new File(configFileLocation); if (configFile.exists() && configFile.isFile() && configFile.length() != 0) { rubixSiteExists.set(true); } else { rubixSiteExists.set(false); } } } } if (rubixSiteExists.get()) { conf.addResource(new Path(CacheConfig.getRubixSiteLocation(conf))); CacheConfig.setRubixConfigApplied(conf, true); } return conf; } private  ClusterUtil(); }
ClusterUtil { public static Configuration applyRubixSiteConfig(Configuration conf) { if (CacheConfig.isRubixSiteConfigApplied(conf)) { return conf; } if (rubixSiteExists.get() == null) { synchronized (rubixSiteExists) { if (rubixSiteExists.get() == null) { String configFileLocation = CacheConfig.getRubixSiteLocation(conf); File configFile = new File(configFileLocation); if (configFile.exists() && configFile.isFile() && configFile.length() != 0) { rubixSiteExists.set(true); } else { rubixSiteExists.set(false); } } } } if (rubixSiteExists.get()) { conf.addResource(new Path(CacheConfig.getRubixSiteLocation(conf))); CacheConfig.setRubixConfigApplied(conf, true); } return conf; } private  ClusterUtil(); static String getMasterHostname(Configuration conf); static Configuration applyRubixSiteConfig(Configuration conf); static Set<MetricsReporterType> getMetricsReporters(Configuration configuration); }
ClusterUtil { public static Configuration applyRubixSiteConfig(Configuration conf) { if (CacheConfig.isRubixSiteConfigApplied(conf)) { return conf; } if (rubixSiteExists.get() == null) { synchronized (rubixSiteExists) { if (rubixSiteExists.get() == null) { String configFileLocation = CacheConfig.getRubixSiteLocation(conf); File configFile = new File(configFileLocation); if (configFile.exists() && configFile.isFile() && configFile.length() != 0) { rubixSiteExists.set(true); } else { rubixSiteExists.set(false); } } } } if (rubixSiteExists.get()) { conf.addResource(new Path(CacheConfig.getRubixSiteLocation(conf))); CacheConfig.setRubixConfigApplied(conf, true); } return conf; } private  ClusterUtil(); static String getMasterHostname(Configuration conf); static Configuration applyRubixSiteConfig(Configuration conf); static Set<MetricsReporterType> getMetricsReporters(Configuration configuration); static volatile AtomicReference<Boolean> rubixSiteExists; }