當前位置: 首頁>>代碼示例>>Java>>正文


Java Config.withFallback方法代碼示例

本文整理匯總了Java中com.typesafe.config.Config.withFallback方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.withFallback方法的具體用法?Java Config.withFallback怎麽用?Java Config.withFallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.typesafe.config.Config的用法示例。


在下文中一共展示了Config.withFallback方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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"));
}
 
開發者ID:Nordstrom,項目名稱:xrpc,代碼行數:41,代碼來源:XConfig.java

示例2: initActorSystem

import com.typesafe.config.Config; //導入方法依賴的package包/類
public void initActorSystem(File file, String akkaName, String configName) {
    logger.debug("init Actor System start: akkaName=" + akkaName + " configName:" + configName);

    Config cg = ConfigFactory.parseFile(file);

    cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
    Config config = ConfigFactory.load(cg).getConfig(configName);
    system = ActorSystem.create(akkaName, config);
    inbox = Inbox.create(system);
    logger.debug("init Actor System end");
}
 
開發者ID:zerosoft,項目名稱:CodeBroker,代碼行數:12,代碼來源:AkkaBootService.java

示例3: initActorSystem

import com.typesafe.config.Config; //導入方法依賴的package包/類
public void initActorSystem(File file, String akkaName, String configName) {
    logger.debug("init Actor System start: akkaName=" + akkaName + " configName:" + configName);
    Config cg = ConfigFactory.parseFile(file);

    cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
    Config config = ConfigFactory.load(cg).getConfig(configName);
    system = ActorSystem.create(akkaName, config);
    inbox = Inbox.create(system);
    logger.debug("init Actor System end");
}
 
開發者ID:zerosoft,項目名稱:CodeBroker,代碼行數:11,代碼來源:AkkaBootService.java

示例4: setup

import com.typesafe.config.Config; //導入方法依賴的package包/類
@BeforeClass
public static void setup() {
    File file = new File("D:\\Users\\xl\\workspace\\FlayShooting\\conf\\application.conf");
    Config cg = ConfigFactory.parseFile(file);
    cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
    Config config = ConfigFactory.load(cg).getConfig("CodeBroker");
    system = ActorSystem.create("CodeBroker", config);
}
 
開發者ID:zerosoft,項目名稱:CodeBroker,代碼行數:9,代碼來源:CodeBrokerTest.java

示例5: merge

import com.typesafe.config.Config; //導入方法依賴的package包/類
protected Config merge() {
    Config config = ConfigFactory.parseMap(configHolder);
    if (fallback != null) {
        config = config.withFallback(fallback);
    }

    return config;
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:9,代碼來源:AbstractConfig.java

示例6: overrideParams

import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
 * Puts a new config atop of existing stack making the options
 * in the supplied config overriding existing options
 * Once put this config can't be removed
 *
 * @param overrideOptions - atop config
 */
public void overrideParams(Config overrideOptions) {
    config = overrideOptions.withFallback(config);
    validateConfig();
}
 
開發者ID:talentchain,項目名稱:talchain,代碼行數:12,代碼來源:SystemProperties.java


注:本文中的com.typesafe.config.Config.withFallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。