当前位置: 首页>>代码示例>>Java>>正文


Java Config.getInt方法代码示例

本文整理汇总了Java中org.apache.samza.config.Config.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java Config.getInt方法的具体用法?Java Config.getInt怎么用?Java Config.getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.samza.config.Config的用法示例。


在下文中一共展示了Config.getInt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateIntStreamPartitions

import org.apache.samza.config.Config; //导入方法依赖的package包/类
private static void calculateIntStreamPartitions(JobGraph jobGraph, Config config) {
  int partitions = config.getInt(JobConfig.JOB_INTERMEDIATE_STREAM_PARTITIONS(), StreamEdge.PARTITIONS_UNKNOWN);
  if (partitions < 0) {
    // use the following simple algo to figure out the partitions
    // partition = MAX(MAX(Input topic partitions), MAX(Output topic partitions))
    // partition will be further bounded by MAX_INFERRED_PARTITIONS.
    // This is important when running in hadoop where an HDFS input can have lots of files (partitions).
    int maxInPartitions = maxPartition(jobGraph.getSources());
    int maxOutPartitions = maxPartition(jobGraph.getSinks());
    partitions = Math.max(maxInPartitions, maxOutPartitions);

    if (partitions > MAX_INFERRED_PARTITIONS) {
      partitions = MAX_INFERRED_PARTITIONS;
      log.warn(String.format("Inferred intermediate stream partition count %d is greater than the max %d. Using the max.",
          partitions, MAX_INFERRED_PARTITIONS));
    }
  }
  for (StreamEdge edge : jobGraph.getIntermediateStreamEdges()) {
    if (edge.getPartitionCount() <= 0) {
      edge.setPartitionCount(partitions);
    }
  }
}
 
开发者ID:apache,项目名称:samza,代码行数:24,代码来源:ExecutionPlanner.java

示例2: create

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
public DiskQuotaPolicy create(Config config) {
  final int entryCount = config.getInt(POLICY_COUNT_KEY, 0);
  if (entryCount == 0) {
    log.info("Using a no throttling disk quota policy because policy entry count was missing or set to zero ({})",
        POLICY_COUNT_KEY);
    return new NoThrottlingDiskQuotaPolicy();
  }

  final List<WatermarkDiskQuotaPolicy.Entry> entries = new ArrayList<WatermarkDiskQuotaPolicy.Entry>();
  for (int i = 0; i < entryCount; ++i) {
    final double lowWaterMark = config.getDouble(String.format("container.disk.quota.policy.%d.lowWaterMark", i));
    final double highWaterMark = config.getDouble(String.format("container.disk.quota.policy.%d.highWaterMark", i));
    final double workFactor = config.getDouble(String.format("container.disk.quota.policy.%d.workFactor", i));
    entries.add(new WatermarkDiskQuotaPolicy.Entry(lowWaterMark, highWaterMark, workFactor));
  }

  return new WatermarkDiskQuotaPolicy(entries);
}
 
开发者ID:apache,项目名称:samza,代码行数:20,代码来源:WatermarkDiskQuotaPolicyFactory.java

示例3: getConsumer

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
public SystemConsumer getConsumer(String systemName, Config config, MetricsRegistry registry) {
  String host = config.get("systems." + systemName + ".host");
  int port = config.getInt("systems." + systemName + ".port");
  WikipediaFeed feed = new WikipediaFeed(host, port);

  return new WikipediaConsumer(systemName, feed, registry);
}
 
开发者ID:yoloanalytics,项目名称:bigdata-swamp,代码行数:9,代码来源:WikipediaSystemFactory.java

示例4: ConfigManager

import org.apache.samza.config.Config; //导入方法依赖的package包/类
public ConfigManager(Config config) {

    //get rm address and port
    if (!config.containsKey(rmAddressOpt) || !config.containsKey(rmPortOpt)) {
      throw new IllegalArgumentException("Missing config: the config file does not contain the rm host or port.");
    }
    String rmAddress = config.get(rmAddressOpt);
    int rmPort = config.getInt(rmPortOpt);

    //get job name and id;
    if (!config.containsKey(JobConfig.JOB_NAME())) {
      throw new IllegalArgumentException("Missing config: the config does not contain the job name");
    }
    jobName = config.get(JobConfig.JOB_NAME());
    jobID = config.getInt(JobConfig.JOB_ID(), 1);

    //set polling interval
    if (config.containsKey(pollingIntervalOpt)) {
      long pollingInterval = config.getLong(pollingIntervalOpt);
      if (pollingInterval <= 0) {
        throw new IllegalArgumentException("polling interval cannot be a negative value");
      }
      this.interval = pollingInterval;
    } else {
      this.interval = defaultPollingInterval;
    }

    this.config = config;
    CoordinatorStreamSystemFactory coordinatorStreamSystemFactory = new CoordinatorStreamSystemFactory();
    this.coordinatorStreamConsumer = coordinatorStreamSystemFactory.getCoordinatorStreamSystemConsumer(config, new MetricsRegistryMap());
    this.yarnUtil = new YarnUtil(rmAddress, rmPort);
  }
 
开发者ID:apache,项目名称:samza,代码行数:33,代码来源:ConfigManager.java

示例5: init

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void init(Config config, TaskContext context) {
  this.store = (KeyValueStore<String, String>) context.getStore("checker-state");
  this.expectedKeys = config.getInt("expected.keys");
  this.numPartitions = config.getInt("num.partitions");
}
 
开发者ID:apache,项目名称:samza,代码行数:8,代码来源:Checker.java

示例6: init

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
public void init(Config config, TaskContext context) throws Exception {
  maxMessages = config.getInt("task.max.messages", 50);
  String outputSystemStreamString = config.get("task.outputs", null);
  if (outputSystemStreamString == null) {
    throw new ConfigException("Missing required configuration: task.outputs");
  }
  outputSystemStream = Util.getSystemStreamFromNames(outputSystemStreamString);
}
 
开发者ID:apache,项目名称:samza,代码行数:10,代码来源:NegateNumberTask.java

示例7: TestAvroSystemConsumer

import org.apache.samza.config.Config; //导入方法依赖的package包/类
public TestAvroSystemConsumer(String systemName, Config config) {
  numMessages = config.getInt(String.format("systems.%s.%s", systemName, CFG_NUM_MESSAGES), DEFAULT_NUM_EVENTS);
}
 
开发者ID:apache,项目名称:samza,代码行数:4,代码来源:TestAvroSystemFactory.java

示例8: init

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
public void init(Config config, TaskContext context) {
  this.state = (KeyValueStore<String, String>) context.getStore("emitter-state");
  this.taskName = context.getTaskName();
  this.max = config.getInt("count");
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:Emitter.java

示例9: init

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
public void init(Config config, TaskContext context) {
  this.store = (KeyValueStore<String, String>) context.getStore("joiner-state");
  this.expected = config.getInt("num.partitions");
  this.taskName = context.getTaskName();
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:Joiner.java

示例10: init

import org.apache.samza.config.Config; //导入方法依赖的package包/类
@Override
public void init(Config config, TaskContext taskContext) throws Exception {
  this.expectedMessageCount = config.getInt("app.messageCount");
  this.outputTopic = config.get("app.outputTopic", "output");
  this.outputSystem = config.get("app.outputSystem", "test-system");
}
 
开发者ID:apache,项目名称:samza,代码行数:7,代码来源:IdentityStreamTask.java


注:本文中的org.apache.samza.config.Config.getInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。