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


Java KafkaThread类代码示例

本文整理汇总了Java中org.apache.kafka.common.utils.KafkaThread的典型用法代码示例。如果您正苦于以下问题:Java KafkaThread类的具体用法?Java KafkaThread怎么用?Java KafkaThread使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KafkaThread类属于org.apache.kafka.common.utils包,在下文中一共展示了KafkaThread类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: KafkaAdminClient

import org.apache.kafka.common.utils.KafkaThread; //导入依赖的package包/类
private KafkaAdminClient(AdminClientConfig config, String clientId, Time time, Metadata metadata,
                 Metrics metrics, KafkaClient client, TimeoutProcessorFactory timeoutProcessorFactory) {
    this.defaultTimeoutMs = config.getInt(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG);
    this.clientId = clientId;
    this.time = time;
    this.metadata = metadata;
    List<InetSocketAddress> addresses = ClientUtils.parseAndValidateAddresses(
        config.getList(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG));
    this.metadata.update(Cluster.bootstrap(addresses), Collections.<String>emptySet(), time.milliseconds());
    this.metrics = metrics;
    this.client = client;
    this.runnable = new AdminClientRunnable();
    String threadName = "kafka-admin-client-thread" + (clientId.length() > 0 ? " | " + clientId : "");
    this.thread = new KafkaThread(threadName, runnable, false);
    this.timeoutProcessorFactory = (timeoutProcessorFactory == null) ?
        new TimeoutProcessorFactory() : timeoutProcessorFactory;
    this.maxRetries = config.getInt(AdminClientConfig.RETRIES_CONFIG);
    config.logUnused();
    log.debug("Created Kafka admin client {}", this.clientId);
    thread.start();
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:22,代码来源:KafkaAdminClient.java

示例2: init

import org.apache.kafka.common.utils.KafkaThread; //导入依赖的package包/类
@Override
public void init(List<KafkaMetric> metrics) {
  for (KafkaMetric kafkaMetric : metrics) {
    addMetricIfInterested(kafkaMetric);
  }
  LOG.info("Added {} Kafka metrics for Cruise Control metrics during initialization.", _interestedMetrics.size());
  _metricsReporterRunner = new KafkaThread("CruiseControlMetricsReporterRunner", this, true);
  _yammerMetricProcessor = new YammerMetricProcessor();
  _metricsReporterRunner.start();
}
 
开发者ID:linkedin,项目名称:cruise-control,代码行数:11,代码来源:CruiseControlMetricsReporter.java


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