org.apache.kafka.connect.errors.ConnectException.getMessage()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(147)

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

ConnectException.getMessage介绍

暂无

代码示例

代码示例来源:origin: qubole/streamx

public void close(Collection<TopicPartition> partitions) {
 // Close any writers we have. We may get assigned the same partitions and end up duplicating
 // some effort since we'll have to reprocess those messages. It may be possible to hold on to
 // the TopicPartitionWriter and continue to use the temp file, but this can get significantly
 // more complex due to potential failures and network partitions. For example, we may get
 // this close, then miss a few generations of group membership, during which
 // data may have continued to be processed and we'd have to restart from the recovery stage,
 // make sure we apply the WAL, and only reuse the temp file if the starting offset is still
 // valid. For now, we prefer the simpler solution that may result in a bit of wasted effort.
 for (TopicPartition tp: assignment) {
  try {
   topicPartitionWriters.get(tp).close();
  } catch (ConnectException e) {
   log.error("Error closing writer for {}. Error: {}", tp, e.getMessage());
  } finally {
   topicPartitionWriters.remove(tp);
  }
 }
}

代码示例来源:origin: salesforce/mirus

@Override
public void run() {
 logger.info("Starting a task monitor thread...");
 Runtime.getRuntime().addShutdownHook(shutdownHook);
 while (!shutdown.get()) {
  try {
   herder.connectors(this::onConnectors);
   try {
    boolean isCountZero = countDownLatch.await(pollingIntervalMillis, TimeUnit.MILLISECONDS);
    shutdown.set(isCountZero);
   } catch (InterruptedException e) {
    logger.info("Exiting TaskMonitor thread...");
   }
  } catch (ConnectException e) {
   logger.warn(
     "TaskMonitor thread will continue to execute despite exception. Caught exception: {}",
     e.getMessage());
  }
 }
}

相关文章

微信公众号

最新文章

更多