org.apache.kafka.common.utils.Utils.sleep()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.apache.kafka.common.utils.Utils.sleep()方法的一些代码示例,展示了Utils.sleep()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.sleep()方法的具体详情如下:
包路径:org.apache.kafka.common.utils.Utils
类名称:Utils
方法名:sleep

Utils.sleep介绍

[英]Sleep for a bit
[中]睡一会儿

代码示例

代码示例来源:origin: org.apache.kafka/connect-runtime

private void backoff(long ms) {
  Utils.sleep(ms);
}

代码示例来源:origin: confluentinc/kafka-streams-examples

Utils.sleep(50);
Utils.sleep(50);

代码示例来源:origin: org.apache.kafka/kafka-streams

@Override
public synchronized void start() {
  super.start();
  while (!stillRunning()) {
    Utils.sleep(1);
    if (startupException != null) {
      throw startupException;
    }
  }
}

代码示例来源:origin: org.apache.kafka/kafka-streams

retries,
  retryableException);
Utils.sleep(retryBackoffMs);

代码示例来源:origin: org.apache.kafka/connect-runtime

public void start() {
  log.info("Starting KafkaBasedLog with topic " + topic);
  initializer.run();
  producer = createProducer();
  consumer = createConsumer();
  List<TopicPartition> partitions = new ArrayList<>();
  // We expect that the topics will have been created either manually by the user or automatically by the herder
  List<PartitionInfo> partitionInfos = null;
  long started = time.milliseconds();
  while (partitionInfos == null && time.milliseconds() - started < CREATE_TOPIC_TIMEOUT_MS) {
    partitionInfos = consumer.partitionsFor(topic);
    Utils.sleep(Math.min(time.milliseconds() - started, 1000));
  }
  if (partitionInfos == null)
    throw new ConnectException("Could not look up partition metadata for offset backing store topic in" +
        " allotted period. This could indicate a connectivity issue, unavailable topic partitions, or if" +
        " this is your first use of the topic it may have taken too long to create.");
  for (PartitionInfo partition : partitionInfos)
    partitions.add(new TopicPartition(partition.topic(), partition.partition()));
  consumer.assign(partitions);
  readToLogEnd();
  thread = new WorkThread();
  thread.start();
  log.info("Finished reading KafkaBasedLog for topic " + topic);
  log.info("Started KafkaBasedLog for topic " + topic);
}

代码示例来源:origin: org.apache.kafka/kafka-streams

retries,
  retryableException);
Utils.sleep(retryBackoffMs);

相关文章