本文整理匯總了Java中com.typesafe.config.Config.getInt方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.getInt方法的具體用法?Java Config.getInt怎麽用?Java Config.getInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.getInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GrapheneRESTServer
import com.typesafe.config.Config; //導入方法依賴的package包/類
GrapheneRESTServer() {
Config config = ConfigFactory.load()
.withFallback(ConfigFactory.load("reference"))
.withFallback(ConfigFactory.load("application"));
log.debug("initializing Graphene");
Graphene graphene = new Graphene(config);
log.debug("Graphene initialized");
ResourceConfig rc = generateResourceConfig(config, graphene);
String uri = "http://" + config.getString("graphene.server.host-name");
uri += config.hasPath("graphene.server.port") ? ":" + config.getInt("graphene.server.port") : "";
uri += "/";
uri += config.hasPath("graphene.server.path") ? config.getString("graphene.server.path") : "";
log.info("Server will run at: '{}'", uri);
server = JettyHttpContainerFactory.createServer(
URI.create(uri),
rc,
false);
log.info("Server successfully initialized, waiting for start.");
}
示例2: save
import com.typesafe.config.Config; //導入方法依賴的package包/類
@Override
public void save() {
Config config = Initializer.getConfig();
ResourceBundle i18n = Initializer.getToolBox().getI18nBundle();
int sharkPort = config.getInt("sharktopoda.defaults.control.port");
int fgPort = config.getInt("sharktopoda.defaults.framegrab.port");
try {
sharkPort = Integer.parseInt(controlPortTextField.getText());
fgPort = Integer.parseInt(framegrabPortTextField.getText());
}
catch (Exception e) {
Initializer.getToolBox()
.getEventBus()
.send(new ShowNonfatalErrorAlert(i18n.getString("mediaplayer.sharktopoda.error.title"),
i18n.getString("mediaplayer.sharktopoda.error.header"),
i18n.getString("mediaplayer.sharktopoda.error.content"),
e));
}
prefs.putInt(CONTROL_PORT_KEY, sharkPort);
prefs.putInt(FRAMEGRAB_PORT_KEY, fgPort);
}
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:23,代碼來源:SharktopodaSettingsPaneController.java
示例3: ALSUpdate
import com.typesafe.config.Config; //導入方法依賴的package包/類
public ALSUpdate(Config config) {
super(config);
iterations = config.getInt("oryx.als.iterations");
implicit = config.getBoolean("oryx.als.implicit");
logStrength = config.getBoolean("oryx.als.logStrength");
Preconditions.checkArgument(iterations > 0);
hyperParamValues = new ArrayList<>(Arrays.asList(
HyperParams.fromConfig(config, "oryx.als.hyperparams.features"),
HyperParams.fromConfig(config, "oryx.als.hyperparams.lambda"),
HyperParams.fromConfig(config, "oryx.als.hyperparams.alpha")));
if (logStrength) {
hyperParamValues.add(HyperParams.fromConfig(config, "oryx.als.hyperparams.epsilon"));
}
noKnownItems = config.getBoolean("oryx.als.no-known-items");
decayFactor = config.getDouble("oryx.als.decay.factor");
decayZeroThreshold = config.getDouble("oryx.als.decay.zero-threshold");
Preconditions.checkArgument(iterations > 0);
Preconditions.checkArgument(decayFactor > 0.0 && decayFactor <= 1.0);
Preconditions.checkArgument(decayZeroThreshold >= 0.0);
}
示例4: MLUpdate
import com.typesafe.config.Config; //導入方法依賴的package包/類
protected MLUpdate(Config config) {
this.testFraction = config.getDouble("oryx.ml.eval.test-fraction");
int candidates = config.getInt("oryx.ml.eval.candidates");
this.evalParallelism = config.getInt("oryx.ml.eval.parallelism");
this.threshold = ConfigUtils.getOptionalDouble(config, "oryx.ml.eval.threshold");
this.maxMessageSize = config.getInt("oryx.update-topic.message.max-size");
Preconditions.checkArgument(testFraction >= 0.0 && testFraction <= 1.0);
Preconditions.checkArgument(candidates > 0);
Preconditions.checkArgument(evalParallelism > 0);
Preconditions.checkArgument(maxMessageSize > 0);
if (testFraction == 0.0) {
if (candidates > 1) {
log.info("Eval is disabled (test fraction = 0) so candidates is overridden to 1");
candidates = 1;
}
}
this.candidates = candidates;
this.hyperParamSearch = config.getString("oryx.ml.eval.hyperparam-search");
}
示例5: GBDTModelParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public GBDTModelParams(Config config, String prefix) {
data_path = config.getString(prefix + KEY + "data_path");
need_dict = config.getBoolean(prefix + KEY + "need_dict");
dict_path = config.getString(prefix + KEY + "dict_path");
dump_freq = config.getInt(prefix + KEY + "dump_freq");
// do not dump
if (dump_freq == -1) {
dump_freq = Integer.MAX_VALUE;
}
continue_train = config.getBoolean(prefix + KEY + "continue_train");
feature_importance_path = config.getString(prefix + KEY + "feature_importance_path");
checkParams();
}
示例6: heartbeatInterval
import com.typesafe.config.Config; //導入方法依賴的package包/類
private int heartbeatInterval(Config config) {
if (config.hasPath(heartbeatIntervalParameter)) {
return config.getInt(heartbeatIntervalParameter);
} else {
return defaultHeartbeatInterval;
}
}
示例7: ServingLayer
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* Creates a new instance with the given configuration.
*
* @param config configuration for the serving layer
*/
public ServingLayer(Config config) {
Objects.requireNonNull(config);
log.info("Configuration:\n{}", ConfigUtils.prettyPrint(config));
this.config = config;
this.id = ConfigUtils.getOptionalString(config, "oryx.id");
this.port = config.getInt("oryx.serving.api.port");
this.securePort = config.getInt("oryx.serving.api.secure-port");
this.userName = ConfigUtils.getOptionalString(config, "oryx.serving.api.user-name");
this.password = ConfigUtils.getOptionalString(config, "oryx.serving.api.password");
String keystoreFileString =
ConfigUtils.getOptionalString(config, "oryx.serving.api.keystore-file");
this.keystoreFile = keystoreFileString == null ? null : Paths.get(keystoreFileString);
this.keystorePassword =
ConfigUtils.getOptionalString(config, "oryx.serving.api.keystore-password");
this.keyAlias = ConfigUtils.getOptionalString(config, "oryx.serving.api.key-alias");
String contextPathString = config.getString("oryx.serving.api.context-path");
if (contextPathString == null ||
contextPathString.isEmpty() ||
"/".equals(contextPathString)) {
contextPathString = "";
}
this.contextPathURIBase = contextPathString;
this.appResourcesPackages =
config.getString("oryx.serving.application-resources") + "," +
"com.cloudera.oryx.lambda.serving"; // Always append package for e.g. error page
// For tests only:
this.doNotInitTopics = config.getBoolean("oryx.serving.no-init-topics");
}
示例8: XConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* Construct a config object using the provided configuration, falling back on the default
* configuration values <a
* href="https://github.com/Nordstrom/xrpc/blob/master/src/main/resources/com/nordstrom/xrpc/xrpc.conf">here</a>.
*/
public XConfig(Config configOverrides) {
Config defaultConfig = ConfigFactory.parseResources(this.getClass(), "xrpc.conf");
Config config = configOverrides.withFallback(defaultConfig);
readerIdleTimeout = config.getInt("reader_idle_timeout_seconds");
writerIdleTimeout = config.getInt("writer_idle_timeout_seconds");
allIdleTimeout = config.getInt("all_idle_timeout_seconds");
workerNameFormat = config.getString("worker_name_format");
bossThreadCount = config.getInt("boss_thread_count");
workerThreadCount = config.getInt("worker_thread_count");
maxConnections = config.getInt("max_connections");
rateLimiterPoolSize = config.getInt("rate_limiter_pool_size");
softReqPerSec = config.getDouble("soft_req_per_sec");
hardReqPerSec = config.getDouble("hard_req_per_sec");
gloablSoftReqPerSec = config.getDouble("global_soft_req_per_sec");
globalHardReqPerSec = config.getDouble("global_hard_req_per_sec");
cert = config.getString("cert");
key = config.getString("key");
port = config.getInt("server.port");
slf4jReporter = config.getBoolean("slf4j_reporter");
jmxReporter = config.getBoolean("jmx_reporter");
consoleReporter = config.getBoolean("console_reporter");
slf4jReporterPollingRate = config.getInt("slf4j_reporter_polling_rate");
consoleReporterPollingRate = config.getInt("console_reporter_polling_rate");
enableWhiteList = config.getBoolean("enable_white_list");
enableBlackList = config.getBoolean("enable_black_list");
ipBlackList =
ImmutableSet.<String>builder().addAll(config.getStringList("ip_black_list")).build();
ipWhiteList =
ImmutableSet.<String>builder().addAll(config.getStringList("ip_white_list")).build();
populateClientOverrideList(config.getObjectList("req_per_second_override"));
}
示例9: MulticlassLinearModelDataFlow
import com.typesafe.config.Config; //導入方法依賴的package包/類
public MulticlassLinearModelDataFlow(IFileSystem fs,
Config config,
ThreadCommSlave comm,
int threadNum,
boolean needPyTransform,
String pyTransformScript) throws Exception {
super(fs, config,
comm,
threadNum,
needPyTransform,
pyTransformScript);
this.K = config.getInt("k");
LOG_UTILS.importantInfo("K:" + K);
}
示例10: LocalSnapshotStore
import com.typesafe.config.Config; //導入方法依賴的package包/類
public LocalSnapshotStore(final Config config) {
this.executionContext = context().system().dispatchers().lookup(config.getString("stream-dispatcher"));
snapshotDir = new File(config.getString("dir"));
int localMaxLoadAttempts = config.getInt("max-load-attempts");
maxLoadAttempts = localMaxLoadAttempts > 0 ? localMaxLoadAttempts : 1;
LOG.debug("LocalSnapshotStore ctor: snapshotDir: {}, maxLoadAttempts: {}", snapshotDir, maxLoadAttempts);
}
示例11: RandomParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public RandomParams(Config config, String prefix) {
mode = Mode.getMode(config.getString(prefix + KEY + "mode"));
seed = config.getInt(prefix + KEY + "seed");
normal = new Normal(config, prefix + KEY);
uniform = new Uniform(config, prefix + KEY);
CheckUtils.check(mode != Mode.UNKNOWN, "unknown %smode:%s, only support:%s",
prefix + KEY, mode, Mode.allToString());
}
示例12: GBMLRDataFlow
import com.typesafe.config.Config; //導入方法依賴的package包/類
public GBMLRDataFlow(IFileSystem fs,
Config config,
ThreadCommSlave comm,
int threadNum,
boolean needPyTransform,
String pyTransformScript) throws Exception {
super(fs, config,
comm,
threadNum,
needPyTransform,
pyTransformScript);
this.K = config.getInt("k");
//this.seed = config.getInt("seed");
this.randomSampleRate = config.getDouble("instance_sample_rate");
this.randomFeatureRate = config.getDouble("feature_sample_rate");
this.uniformBaseScore = (float) LossFunctions.createLossFunction(commonParams.lossParams.loss_function).
pred2Score(config.getDouble("uniform_base_prediction"));
this.sampleDepdtBaseScore = config.getBoolean("sample_dependent_base_prediction");
this.treeNum = config.getInt("tree_num");
this.learningRate = config.getDouble("learning_rate");
this.randomParams = new RandomParams(config, "");
this.type = Type.getType(config.getString("type"));
if (type == Type.RF) {
this.learningRate = 1.0;
}
CheckUtils.check(K >= 2, "K:%d must >= 2", K);
LOG_UTILS.importantInfo("K:" + K);
//comm.LOG_UTILS.importantInfo("seed:" + seed);
LOG_UTILS.importantInfo("random:" + randomParams);
LOG_UTILS.importantInfo("instance_sample_rate:" + randomSampleRate);
LOG_UTILS.importantInfo("feature_sample_rate:" + randomFeatureRate);
LOG_UTILS.importantInfo("uniform_base_prediction:" + uniformBaseScore);
LOG_UTILS.importantInfo("tree_num:" + treeNum);
LOG_UTILS.importantInfo("learning_rate:" + learningRate);
LOG_UTILS.importantInfo("type:" + type);
}
示例13: RDFUpdate
import com.typesafe.config.Config; //導入方法依賴的package包/類
public RDFUpdate(Config config) {
super(config);
numTrees = config.getInt("oryx.rdf.num-trees");
Preconditions.checkArgument(numTrees >= 1);
hyperParamValues = Arrays.asList(
HyperParams.fromConfig(config, "oryx.rdf.hyperparams.max-split-candidates"),
HyperParams.fromConfig(config, "oryx.rdf.hyperparams.max-depth"),
HyperParams.fromConfig(config, "oryx.rdf.hyperparams.impurity"));
inputSchema = new InputSchema(config);
Preconditions.checkArgument(inputSchema.hasTarget());
}
示例14: SpeedLayer
import com.typesafe.config.Config; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public SpeedLayer(Config config) {
super(config);
this.updateBroker = config.getString("oryx.update-topic.broker");
this.updateTopic = config.getString("oryx.update-topic.message.topic");
this.maxMessageSize = config.getInt("oryx.update-topic.message.max-size");
this.updateTopicBroker = config.getString("oryx.update-topic.broker");
this.modelManagerClassName = config.getString("oryx.speed.model-manager-class");
this.updateDecoderClass = (Class<? extends Deserializer<U>>) ClassUtils.loadClass(
config.getString("oryx.update-topic.message.decoder-class"), Deserializer.class);
Preconditions.checkArgument(maxMessageSize > 0);
}
示例15: startServerProduceConsumeTopics
import com.typesafe.config.Config; //導入方法依賴的package包/類
protected List<KeyMessage<String,String>> startServerProduceConsumeTopics(
Config config,
DatumGenerator<String,String> datumGenerator,
int howMany,
int intervalMsec) throws InterruptedException {
ProduceData produce = new ProduceData(datumGenerator,
getKafkaBrokerPort(),
INPUT_TOPIC,
howMany,
intervalMsec);
List<KeyMessage<String,String>> keyMessages;
try (CloseableIterator<KeyMessage<String,String>> data =
new ConsumeData(UPDATE_TOPIC, getKafkaBrokerPort()).iterator();
BatchLayer<?,?,?> batchLayer = new BatchLayer<>(config)) {
log.info("Starting batch layer");
batchLayer.start();
// Sleep to let batch layer start
sleepSeconds(3);
log.info("Starting consumer thread");
ConsumeTopicRunnable consumeInput = new ConsumeTopicRunnable(data);
new Thread(LoggingCallable.log(consumeInput).asRunnable(), "ConsumeInputThread").start();
consumeInput.awaitRun();
log.info("Producing data");
produce.start();
// Sleep generation before shutting down server to let it finish
int genIntervalSec = config.getInt("oryx.batch.streaming.generation-interval-sec");
sleepSeconds(genIntervalSec);
keyMessages = consumeInput.getKeyMessages();
}
return keyMessages;
}