List of usage examples for org.apache.commons.configuration Configuration getInt
int getInt(String key, int defaultValue);
From source file:com.microrisc.simply.connector.response_waiting.SimpleResponseWaitingConnectorConfigurator.java
@Override public void configure(ResponseWaitingConnector connector, Configuration configuration) { int maxSendAttempts = configuration.getInt("connector.type.responseWaiting.maxSendAttempts", -1); if (maxSendAttempts != -1) { connector.setMaxSendAttempts(maxSendAttempts); }/* ww w . j a v a 2 s .c om*/ long responseTimeoutSetting = configuration.getLong("connector.type.responseWaiting.responseTimeout", -1); if (responseTimeoutSetting != -1) { connector.setResponseTimeout(responseTimeoutSetting); } long attemptPause = configuration.getLong("connector.type.responseWaiting.attemptPause", -1); if (attemptPause != -1) { connector.setAttemptPause(attemptPause); } long betweenSendPause = configuration.getLong("connector.type.responseWaiting.betweenSendPause", -1); if (betweenSendPause != -1) { connector.setBetweenSendPause(betweenSendPause); } }
From source file:com.linkedin.pinot.core.query.scheduler.resources.ResourceLimitPolicy.java
private int checkGetOrDefaultPct(Configuration schedulerConfig, String key, int defaultValue) { int pct = schedulerConfig.getInt(key, defaultValue); if (pct <= 0 || pct > 100) { LOGGER.error("Incorrect value for {}, value: {}; using default: {}", key, pct, defaultValue); pct = defaultValue;//from w w w .java 2 s. c om } return pct; }
From source file:com.linkedin.pinot.common.segment.fetcher.HttpSegmentFetcher.java
@Override public void init(Configuration configs) { initHttpClient(configs);/* w ww. j a v a 2 s . co m*/ _retryCount = configs.getInt(RETRY, RETRY_DEFAULT); _retryWaitMs = configs.getInt(RETRY_WAITIME_MS, RETRY_WAITIME_MS_DEFAULT); }
From source file:net.sf.jclal.util.random.AbstractRandGenFactory.java
/** * Configuration method./*from www . ja v a2s . co m*/ * * Configuration parameters for this object are... * * @param settings Configuration settings */ @Override public void configure(Configuration settings) { // Getting seed parameter int seed = settings.getInt("[@seed]", 1234567890); // Setting seed setSeed(seed); }
From source file:net.sf.jclal.activelearning.batchmode.AbstractBatchMode.java
/** * * @param configuration The configuration of Abstract Batch Mode. * *The XML labels supported are:/* w w w . j a v a2 s. com*/ * <ul> * <li>batch-size= int</li> * </ul> */ @Override public void configure(Configuration configuration) { // Set batchSize int batchT = configuration.getInt("batch-size", batchSize); if (batchT <= 0) { throw new ConfigurationRuntimeException( "\nIllegal batch size: <batch-size>" + batchT + "</batch-size>" + ". Batch size > 0"); } setBatchSize(batchT); }
From source file:net.sf.jclal.activelearning.stopcriteria.MaxIteration.java
/** * @param settings/*w w w. j ava2s . co m*/ * The configuration object for the MaxIteration stop criterion * * The XML labels supported are: * <ul> * <li> * <p> * <b>max-iteration= int</b> * </p> * </li> * </ul> */ @Override public void configure(Configuration settings) { // Set max iteration int maxIterationT = settings.getInt("max-iteration", maxIteration); setMaxIteration(maxIterationT); }
From source file:com.linkedin.pinot.routing.builder.BalancedRandomRoutingTableBuilder.java
@Override public void init(Configuration configuration) { _numberOfRoutingTables = configuration.getInt("numOfRoutingTables", 10); }
From source file:com.baifendian.swordfish.execserver.runner.adhoc.AdHocRunnerManager.java
public AdHocRunnerManager(Configuration conf) { adHocDao = DaoFactory.getDaoInstance(AdHocDao.class); int threads = conf.getInt(Constants.EXECUTOR_ADHOCRUNNER_THREADS, Constants.defaultAdhocExecutorNum); ThreadFactory flowThreadFactory = new ThreadFactoryBuilder().setNameFormat("Exec-Server-AdHocRunner") .build();/* w w w. j a va2 s. c o m*/ adHocExecutorService = Executors.newFixedThreadPool(threads, flowThreadFactory); }
From source file:com.cisco.oss.foundation.http.server.jetty.JettyHttpThreadPool.java
private QueuedThreadPool createThreadPool() { Configuration configuration = ConfigurationFactory.getConfiguration(); int minThreads = configuration.getInt(serviceName + ".http.minThreads", 100); int maxThreads = configuration.getInt(serviceName + ".http.maxThreads", 1000); if (minThreads <= 0) { throw new IllegalArgumentException("http server min number of threads must be greater than 0"); }/*from w w w. ja v a2s . c o m*/ QueuedThreadPool queuedThreadPool = new QueuedThreadPool(); queuedThreadPool.setMaxThreads(maxThreads); queuedThreadPool.setMinThreads(minThreads); return queuedThreadPool; }
From source file:com.google.api.ads.adwords.keywordoptimizer.DefaultRoundStrategy.java
/** * Creates a new {@link DefaultRoundStrategy} and takes its parameters from a property file. */// w ww. j a v a2 s . co m public DefaultRoundStrategy(OptimizationContext context) { Configuration config = context.getConfiguration(); maxNumberOfSteps = config.getInt(KeywordOptimizerProperty.RoundStrategyMaxSteps.getName(), 10); minImprovementBetweenSteps = config .getDouble(KeywordOptimizerProperty.RoundStrategyMinImprovementBetweenSteps.getName(), 0); maxPopulationSize = config.getInt(KeywordOptimizerProperty.RoundStrategyMaxPopulation.getName(), 100); maxNumberOfAlternatives = config.getInt(KeywordOptimizerProperty.RoundStrategyReplicateBest.getName(), 10); lastAvgScore = null; }