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

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

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

Utils.closeQuietly介绍

[英]Closes closeable and if an exception is thrown, it is logged at the WARN level.
[中]关闭closeable,如果引发异常,将以警告级别记录。

代码示例

代码示例来源:origin: apache/kafka

@Override
public void close() throws IOException {
  if (principalBuilder instanceof Closeable)
    Utils.closeQuietly((Closeable) principalBuilder, "principal builder");
}

代码示例来源:origin: apache/kafka

@Override
  public void close() {
    if (principalBuilder instanceof Closeable)
      Utils.closeQuietly((Closeable) principalBuilder, "principal builder");
  }
}

代码示例来源:origin: apache/kafka

/**
 * Delete this message set from the filesystem
 * @throws IOException if deletion fails due to an I/O error
 * @return  {@code true} if the file was deleted by this method; {@code false} if the file could not be deleted
 *          because it did not exist
 */
public boolean deleteIfExists() throws IOException {
  Utils.closeQuietly(channel, "FileChannel");
  return Files.deleteIfExists(file.toPath());
}

代码示例来源:origin: apache/kafka

@Override
public void close() throws IOException {
  if (principalBuilder instanceof Closeable)
    Utils.closeQuietly((Closeable) principalBuilder, "principal builder");
  if (saslServer != null)
    saslServer.dispose();
}

代码示例来源:origin: apache/kafka

static KafkaAdminClient createInternal(AdminClientConfig config,
                    AdminMetadataManager metadataManager,
                    KafkaClient client,
                    Time time) {
  Metrics metrics = null;
  String clientId = generateClientId(config);
  try {
    metrics = new Metrics(new MetricConfig(), new LinkedList<>(), time);
    LogContext logContext = createLogContext(clientId);
    return new KafkaAdminClient(config, clientId, time, metadataManager, metrics,
      client, null, logContext);
  } catch (Throwable exc) {
    closeQuietly(metrics, "Metrics");
    throw new KafkaException("Failed to create new KafkaAdminClient", exc);
  }
}

代码示例来源:origin: apache/kafka

log.debug("Timed out {} remaining operation(s).", numTimedOut);
closeQuietly(client, "KafkaClient");
closeQuietly(metrics, "Metrics");
log.debug("Exiting AdminClientRunnable thread.");

代码示例来源:origin: apache/kafka

timeoutProcessorFactory, logContext);
} catch (Throwable exc) {
  closeQuietly(metrics, "Metrics");
  closeQuietly(networkClient, "NetworkClient");
  closeQuietly(selector, "Selector");
  closeQuietly(channelBuilder, "ChannelBuilder");
  throw new KafkaException("Failed to create new KafkaAdminClient", exc);

代码示例来源:origin: apache/kafka

throw new KafkaException(e);
} finally {
  Utils.closeQuietly(stream, "records iterator stream");

代码示例来源:origin: variflight/feeyo-redisproxy

public void close() {
  closeQuietly(metrics, "Metrics");
  closeQuietly(client, "NetworkClient");
  closeQuietly(selector, "Selector");
  closeQuietly(channelBuilder, "ChannelBuilder");
}

相关文章