List of usage examples for org.apache.commons.configuration Configuration containsKey
boolean containsKey(String key);
From source file:edu.berkeley.sparrow.daemon.util.Resources.java
public static int getSystemMemoryMb(Configuration conf) { int systemMemory = -1; try {// ww w . java 2s . c o m Process p = Runtime.getRuntime().exec("cat /proc/meminfo"); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = in.readLine(); while (line != null) { if (line.contains("MemTotal")) { String[] parts = line.split("\\s+"); if (parts.length > 1) { int memory = Integer.parseInt(parts[1]) / 1000; systemMemory = memory; } } line = in.readLine(); } } catch (IOException e) { } if (conf.containsKey(SparrowConf.SYSTEM_MEMORY)) { return conf.getInt(SparrowConf.SYSTEM_MEMORY); } else { if (systemMemory != -1) { return systemMemory; } else { return SparrowConf.DEFAULT_SYSTEM_MEMORY; } } }
From source file:com.github.anba.es6draft.util.Resources.java
/** * Filter the initially collected test cases. *///www . j a v a 2 s . co m private static void filterTests(List<? extends TestInfo> tests, Path basedir, Configuration config) throws IOException { if (DISABLE_ALL_TESTS) { for (TestInfo test : tests) { test.setEnabled(false); } } if (config.containsKey("exclude.list")) { InputStream exclusionList = Resources.resource(config.getString("exclude.list"), basedir); filterTests(tests, exclusionList, config); } if (config.containsKey("exclude.xml")) { Set<String> excludes = readExcludeXMLs(config.getList("exclude.xml", emptyList()), basedir); filterTests(tests, excludes); } }
From source file:ch.epfl.eagle.daemon.util.Resources.java
public static int getSystemMemoryMb(Configuration conf) { int systemMemory = -1; try {//ww w . j a v a 2s .c o m Process p = Runtime.getRuntime().exec("cat /proc/meminfo"); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = in.readLine(); while (line != null) { if (line.contains("MemTotal")) { String[] parts = line.split("\\s+"); if (parts.length > 1) { int memory = Integer.parseInt(parts[1]) / 1000; systemMemory = memory; } } line = in.readLine(); } } catch (IOException e) { } if (conf.containsKey(EagleConf.SYSTEM_MEMORY)) { return conf.getInt(EagleConf.SYSTEM_MEMORY); } else { if (systemMemory != -1) { return systemMemory; } else { return EagleConf.DEFAULT_SYSTEM_MEMORY; } } }
From source file:es.udc.gii.common.eaf.plugin.parameter.Constant.java
@Override public void configure(Configuration conf) { if (conf.containsKey("Value")) { this.value = conf.getDouble("Value"); }/*from www . j a v a2 s.co m*/ }
From source file:es.udc.gii.common.eaf.stoptest.cma.CMATolXUpStopTest.java
@Override public void configure(Configuration conf) { if (conf.containsKey("TolXUpFactor")) { this.tol_up_x_factor = conf.getDouble("TolXUpFactor"); } else {//from w ww. jav a 2s .c o m ConfWarning w = new ConfWarning("TolXUpFactor", this.tol_up_x_factor); w.warn(); } }
From source file:es.udc.gii.common.eaf.stoptest.TolFunHistStopTest.java
@Override public void configure(Configuration conf) { if (conf.containsKey("TolFunHist")) { tol_fun_hist = conf.getDouble("TolFunHist"); } else {/*from www . ja v a2 s. c o m*/ ConfWarning w = new ConfWarning("TolFunHist", this.tol_fun_hist); w.warn(); } }
From source file:es.udc.gii.common.eaf.problem.constraint.Constraint.java
@Override public void configure(Configuration conf) { if (conf.containsKey("ConstraintValue")) { this.constraint_value = conf.getDouble("ConstraintValue"); } else {/*from w ww. j a v a 2 s .c o m*/ (new ConfWarning("Constraint.ConstraintValue", constraint_value)).warn(); } }
From source file:es.udc.gii.common.eaf.stoptest.TolFunStopTest.java
@Override public void configure(Configuration conf) { if (conf.containsKey("TolFun")) { tol_fun = conf.getDouble("TolFun"); } else {/*from w ww.j a v a 2s . c om*/ ConfWarning w = new ConfWarning("TolFun", this.tol_fun); w.warn(); } }
From source file:com.linkedin.pinot.transport.config.ThreadPoolConfig.java
public void init(Configuration cfg) { if (cfg.containsKey(CORE_POOL_SIZE_KEY)) { _corePoolSize = cfg.getInt(CORE_POOL_SIZE_KEY); }/*from w ww .j a va 2s . c o m*/ if (cfg.containsKey(MAX_POOL_SIZE_KEY)) { _maxPoolSize = cfg.getInt(MAX_POOL_SIZE_KEY); } if (cfg.containsKey(IDLE_TIMEOUT_MS_KEY)) { _idleTimeoutMs = cfg.getLong(IDLE_TIMEOUT_MS_KEY); } }
From source file:es.udc.gii.common.eaf.plugin.parameter.LogAnnealing.java
@Override public void configure(Configuration conf) { try {//w ww. j a va 2s . c om if (conf.containsKey("Counter.Class")) { this.counter = (StopTestPlugin) Class.forName(conf.getString("Counter.Class")).newInstance(); this.counter.configure(conf.subset("Counter")); } } catch (Exception ex) { ex.printStackTrace(); } }