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:es.udc.gii.common.eaf.algorithm.operator.selection.TournamentSelection.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);
    if (conf.containsKey("PoolSize")) {
        this.poolSize = conf.getInt("PoolSize");
    } else {/*from  w w w  .java2 s  .  co m*/
        ConfWarning w = new ConfWarning("PoolSize", this.poolSize);
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.selection.DeterministicTournamentSelection.java

@Override
public void configure(Configuration conf) {
    if (conf.containsKey("PoolSize")) {
        this.poolSize = conf.getInt("PoolSize");
    } else {//from  ww w . j  a  va  2s  .  c o m
        this.poolSize = 2;
        (new ConfWarning("DeterministicTournamentSelection.PoolSize", this.poolSize)).warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.replace.ElitismOperator.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);
    if (conf.containsKey("Elitism")) {
        this.elitism = conf.getInt("Elitism");
    } else {//w w  w.j  av  a  2  s . c o m
        ConfWarning w = new ConfWarning("Elitism", this.elitism);
        w.warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.crossover.RandomCrossOver.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);
    if (conf.containsKey("Points")) {
        this.points = conf.getInt("Points");
    } else {/*from   w  w w . j  a  v a 2  s.  com*/
        ConfWarning w = new ConfWarning("Points", this.points);
        w.warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.PolynomialMutation.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);

    if (conf.containsKey("N")) {
        this.N = conf.getInt("N");
    } else {/*from w  w  w  .  j  a v  a2 s .c o m*/
        this.N = 1;
        ConfWarning w = new ConfWarning("PolynomialMutation.N", this.N);
        w.warn();
    }
}

From source file:com.cisco.oss.foundation.message.AbstractMessageDispatcher.java

public AbstractMessageDispatcher(ConcurrentMessageHandler concurrentMessageHandler) {
    this.concurrentMessageHandler = concurrentMessageHandler;

    Configuration configuration = ConfigurationFactory.getConfiguration();
    int maxThreadPoolSize = configuration.getInt(MessageConstants.QUEUE_SIZE_PROPERTY);
    int waitingQueueSize = configuration.getInt(MessageConstants.WAITING_QUEUE_SIZE_PROPERTY);

    waitingList = new CopyOnWriteArrayList<Message>();
    try {/*from   w  w  w .ja v a 2  s. com*/
        if (waitingQueueSize > 0) {
            blockingWaitingQueue = new CapacityEnsurableLinkedBlockingQueue<Runnable>(waitingQueueSize);
        } else {
            blockingWaitingQueue = new CapacityEnsurableLinkedBlockingQueue<Runnable>();
        }
    } catch (Exception ex) {
        LOGGER.error("Failed to create message dispatcher", ex);
    }
    executorService = new ThreadPoolExecutor(maxThreadPoolSize, maxThreadPoolSize, 0L, TimeUnit.MILLISECONDS,
            blockingWaitingQueue); //Executors.newFixedThreadPool(maxThreadPoolSize);
}

From source file:io.fluo.core.impl.AppConfigIT.java

@Test
public void testBasic() {
    Configuration uc = client.getAppConfiguration();
    Assert.assertEquals(50000, uc.getInt("myapp.sizeLimit"));
    uc.setProperty("myapp.sizeLimit", 3);
    uc = client.getAppConfiguration();/*from ww  w  .  ja v  a2s  .  c  o  m*/
    Assert.assertEquals(50000, uc.getInt("myapp.sizeLimit"));

    //update shared config
    Configuration appConfig = config.getAppConfiguration();
    appConfig.clear();
    appConfig.setProperty("myapp.sizeLimit", 40000);
    appConfig.setProperty("myapp.timeLimit", 30000);
    try (FluoAdmin admin = FluoFactory.newAdmin(config)) {
        admin.updateSharedConfig();
    }

    //set app config that differs from what was just put in zk
    appConfig.setProperty("myapp.sizeLimit", 6);
    appConfig.setProperty("myapp.timeLimit", 7);

    try (FluoClient client2 = FluoFactory.newClient(config)) {
        uc = client2.getAppConfiguration();
        Assert.assertEquals(40000, uc.getInt("myapp.sizeLimit"));
        Assert.assertEquals(30000, uc.getInt("myapp.timeLimit"));
    }

}

From source file:com.kixeye.chassis.bootstrap.configuration.zookeeper.CuratorFrameworkBuilder.java

private RetryPolicy buildZookeeperRetryPolicy(Configuration configuration) {
    return new ExponentialBackoffRetry(configuration.getInt(ZOOKEEPER_INITIAL_SLEEP_MILLIS.getPropertyName()),
            configuration.getInt(ZOOKEEPER_MAX_RETRIES.getPropertyName()),
            configuration.getInt(ZOOKEEPER_RETRIES_MAX_MILLIS.getPropertyName()));
}

From source file:ai.grakn.graql.internal.analytics.CommonOLAP.java

/**
 * Load <code>persistentProperties</code> and any hard coded fields from an apache config object for use by the
 * spark executor./*from w  ww .  j a v  a 2 s.  c o m*/
 *
 * @param graph         the tinker graph
 * @param configuration the apache config object containing the values
 */
public void loadState(final Graph graph, final Configuration configuration) {
    // load selected types
    configuration.subset(PREFIX_SELECTED_TYPE_KEY).getKeys().forEachRemaining(
            key -> selectedTypes.add(TypeId.of(configuration.getInt(PREFIX_SELECTED_TYPE_KEY + "." + key))));

    // load user specified properties
    configuration.subset(PREFIX_PERSISTENT_PROPERTIES).getKeys().forEachRemaining(key -> persistentProperties
            .put(key, configuration.getProperty(PREFIX_PERSISTENT_PROPERTIES + "." + key)));
}

From source file:ai.grakn.graql.internal.analytics.DegreeVertexProgram.java

@Override
public void loadState(final Graph graph, final Configuration configuration) {
    super.loadState(graph, configuration);
    configuration.subset(OF_TYPE_LABELS).getKeys().forEachRemaining(
            key -> ofTypeIds.add(TypeId.of(configuration.getInt(OF_TYPE_LABELS + "." + key))));
    degreePropertyKey = (String) this.persistentProperties.get(DEGREE);
}