com.twitter.util.Duration.inMillis()方法的使用及代码示例

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

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

Duration.inMillis介绍

暂无

代码示例

代码示例来源:origin: com.twitter/finagle-serversets

/**
 * Creates a new TruncatedBinaryBackoff that will start by backing off for {@code initialBackoff}
 * and then backoff of twice as long each time its called until reaching the {@code maxBackoff} at
 * which point shouldContinue() will return false and any future backoffs will always wait for
 * that amount of time.
 *
 * @param initialBackoff the intial amount of time to backoff
 * @param maxBackoff the maximum amount of time to backoff
 * @param stopAtMax whether shouldContinue() returns false when the max is reached
 */
public TruncatedBinaryBackoff(Duration initialBackoff,
  Duration maxBackoff, boolean stopAtMax) {
 Objects.requireNonNull(initialBackoff);
 Objects.requireNonNull(maxBackoff);
 if (initialBackoff.inMillis() <= 0) {
  throw new IllegalArgumentException();
 }
 if (maxBackoff.compareTo(initialBackoff) < 0) {
  throw new IllegalArgumentException();
 }
 initialBackoffMs = initialBackoff.inMillis();
 maxBackoffIntervalMs = maxBackoff.inMillis();
 this.stopAtMax = stopAtMax;
}

代码示例来源:origin: com.twitter/finagle-serversets_2.11

/**
 * Creates a new TruncatedBinaryBackoff that will start by backing off for {@code initialBackoff}
 * and then backoff of twice as long each time its called until reaching the {@code maxBackoff} at
 * which point shouldContinue() will return false and any future backoffs will always wait for
 * that amount of time.
 *
 * @param initialBackoff the intial amount of time to backoff
 * @param maxBackoff the maximum amount of time to backoff
 * @param stopAtMax whether shouldContinue() returns false when the max is reached
 */
public TruncatedBinaryBackoff(Duration initialBackoff,
  Duration maxBackoff, boolean stopAtMax) {
 Objects.requireNonNull(initialBackoff);
 Objects.requireNonNull(maxBackoff);
 if (initialBackoff.inMillis() <= 0) {
  throw new IllegalArgumentException();
 }
 if (maxBackoff.compareTo(initialBackoff) < 0) {
  throw new IllegalArgumentException();
 }
 initialBackoffMs = initialBackoff.inMillis();
 maxBackoffIntervalMs = maxBackoff.inMillis();
 this.stopAtMax = stopAtMax;
}

代码示例来源:origin: com.twitter/finagle-serversets

Optional<String> chrootPath,
           Iterable<InetSocketAddress> zooKeeperServers) {
this.sessionTimeoutMs = (int) Objects.requireNonNull(sessionTimeout).inMillis();
this.credentials = Objects.requireNonNull(credentials);

代码示例来源:origin: com.twitter/finagle-serversets_2.11

Optional<String> chrootPath,
           Iterable<InetSocketAddress> zooKeeperServers) {
this.sessionTimeoutMs = (int) Objects.requireNonNull(sessionTimeout).inMillis();
this.credentials = Objects.requireNonNull(credentials);

代码示例来源:origin: com.twitter/finagle-serversets_2.11

if (connectionTimeout.inMillis() > 0) {
 if (!connected.await(connectionTimeout.inMillis(), TimeUnit.MILLISECONDS)) {
  close();
  throw new TimeoutException("Timed out waiting for a ZK connection after "

代码示例来源:origin: com.twitter/finagle-serversets

if (connectionTimeout.inMillis() > 0) {
 if (!connected.await(connectionTimeout.inMillis(), TimeUnit.MILLISECONDS)) {
  close();
  throw new TimeoutException("Timed out waiting for a ZK connection after "

相关文章