本文整理了Java中com.twitter.util.Duration.inMillis()
方法的一些代码示例,展示了Duration.inMillis()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Duration.inMillis()
方法的具体详情如下:
包路径:com.twitter.util.Duration
类名称: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 "
内容来源于网络,如有侵权,请联系作者删除!