Example usage for org.apache.commons.configuration Configuration getInt

List of usage examples for org.apache.commons.configuration Configuration getInt

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getInt.

Prototype

int getInt(String key);

Source Link

Document

Get a int associated with the given configuration key.

Usage

From source file:com.orientechnologies.orient.server.distributed.OrientdbEdgeTest.java

protected static OrientGraphFactory getGraphFactory() throws Exception {
    Configuration conf = new BaseConfiguration();

    conf.setProperty("storage.url", "remote:localhost/test");
    conf.setProperty("storage.pool-min", "1");
    conf.setProperty("storage.pool-max", "10");
    conf.setProperty("storage.user", "admin");
    conf.setProperty("storage.password", "admin");

    OGlobalConfiguration.CLIENT_CONNECT_POOL_WAIT_TIMEOUT.setValue(15000);

    verifyDatabaseExists(conf);//  ww w  .j a  v  a2 s .c  o  m

    return new OrientGraphFactory(conf.getString("storage.url"), conf.getString("storage.user"),
            conf.getString("storage.password")).setupPool(conf.getInt("storage.pool-min"),
                    conf.getInt("storage.pool-max"));
}

From source file:edu.berkeley.sparrow.daemon.util.Resources.java

public static int getSystemMemoryMb(Configuration conf) {
    int systemMemory = -1;
    try {/*  w w w . j a  va2s  .  c  om*/
        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:ch.epfl.eagle.daemon.util.Resources.java

public static int getSystemMemoryMb(Configuration conf) {
    int systemMemory = -1;
    try {//from  w  ww.j  a  va2  s  .  c  om
        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.algorithm.parallel.migration.selection.BestMigration.java

@Override
public void configure(Configuration conf) {
    setHowMany(conf.getInt("HowMany"));
}

From source file:es.udc.gii.common.eaf.benchmark.multiobjective.sym_part.Sym_Part_Objective.java

@Override
public void configure(Configuration conf) {
    this.dimension = conf.getInt("Dimension");
}

From source file:es.udc.gii.common.eaf.stoptest.MaxFEsStopTest.java

/**
 * Configure this stop test./*from  w w w  .ja va 2s.  c  o  m*/
 * @param conf Configuration object which contains the configuration values.
 */
@Override
public void configure(Configuration conf) {
    this.fes = conf.getInt("MaxFEs");
}

From source file:es.udc.gii.common.eaf.stoptest.DimensionFEsStopTest.java

/**
 * Configure this stop test.// w w w .j a v a 2s  .co m
 * @param conf Configuration object which contains the configuration values.
 */
@Override
public void configure(Configuration conf) {
    this.factor = conf.getInt("Factor");
}

From source file:es.udc.gii.common.eaf.stoptest.EvolveGenerationsStopTest.java

/**
 * Configure this stop test.//ww  w.java 2 s . co m
 * @param conf Configuration object which contains the configuration values.
 */
@Override
public void configure(Configuration conf) {
    this.generations = conf.getInt("Generations");
}

From source file:es.udc.gii.common.eaf.algorithm.EvolutionaryStrategy.java

@Override
public void configure(Configuration conf) {
    try {/*from   w w w  .  j a v a  2  s . c om*/
        super.configure(conf);
        this.lambda = conf.getInt("Lambda");
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

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  ww w. ja v a 2  s  .  c  om*/

    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);
    }
}