Codota Logo
Duration.roundTo
Code IndexAdd Codota to your IDE (free)

How to use
roundTo
method
in
com.proofpoint.units.Duration

Best Java code snippets using com.proofpoint.units.Duration.roundTo (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: com.proofpoint.platform/log

private FlushingFileAppender(Duration flushInterval)
{
  this.flushIntervalNanos = flushInterval.roundTo(NANOSECONDS);
}
origin: com.proofpoint.platform/http-client

public DecorrelatedJitteredBackoffPolicy(Duration min, Duration max)
{
  this.min = min.roundTo(TimeUnit.NANOSECONDS);
  this.max = max.roundTo(TimeUnit.NANOSECONDS);
  checkArgument(this.min <= this.max, "min is greater than max");
}
origin: com.proofpoint.platform/http-client

LeakyTokenBucket(Duration ttl, int reserve, Ticker ticker)
{
  windowedAdder = new WindowedAdder(ttl.roundTo(NANOSECONDS), 10, ticker);
  this.reserve = reserve;
}
origin: com.proofpoint.platform/http-client

  @Override
  public Duration backoff(Duration previousBackoff)
  {
    long prev = previousBackoff.roundTo(TimeUnit.NANOSECONDS);
    long range = Math.abs(prev * 3 - min);
    long randBackoff;
    if (range == 0) {
      randBackoff = min;
    } else {
      randBackoff = min + ThreadLocalRandom.current().nextLong(range);
    }
    long backoff = Math.min(max, randBackoff);

    return new Duration(backoff, TimeUnit.NANOSECONDS);
  }
}
origin: com.proofpoint.platform/http-client

private TokenRetryBudget(BigDecimal retryBudgetRatio, Duration retryBudgetRatioPeriod, int retryBudgetMinPerSecond, Ticker ticker)
{
  // if you only have minRetries, everything costs 1 but you
  // get no credit for requests. all credits come via time.
  if (retryBudgetRatio.equals(ZERO)) {
    depositAmount = 0;
    withdrawalAmount = 1;
  }
  else {
    depositAmount = SCALE_FACTOR.intValue();
    withdrawalAmount = SCALE_FACTOR.divide(retryBudgetRatio, ROUND_HALF_UP).intValue();
  }
  // compute the reserve by scaling retryBudgetMinPerSecond by retryBudgetRatioPeriod and retry cost
  // to allow for clients that've just started or have low rps
  int reserve = retryBudgetMinPerSecond * Ints.checkedCast(retryBudgetRatioPeriod.roundTo(SECONDS)) * withdrawalAmount;
  tokenBucket = new LeakyTokenBucket(retryBudgetRatioPeriod, reserve, ticker);
}
origin: com.proofpoint.platform/concurrent

@Managed
public void setKeepAliveTime(String duration)
{
  requireNonNull(duration, "duration is null");
  threadPoolExecutor.setKeepAliveTime(Duration.valueOf(duration).roundTo(NANOSECONDS), NANOSECONDS);
}
origin: com.proofpoint.platform/http-client

  @Override
  public void mark(boolean isFailure, InstanceState uriState, HttpServiceAttemptImpl attempt, HttpServiceBalancerImpl balancer)
  {
    if (isFailure) {
      if (++uriState.numFailures >= balancer.consecutiveFailures) {
        uriState.liveness = DEAD;
        uriState.backoffPolicy = balancer.backoffPolicy;
        uriState.lastBackoff = uriState.backoffPolicy.backoff(ZERO_DURATION);
        uriState.deadUntil = balancer.ticker.read() + uriState.lastBackoff.roundTo(NANOSECONDS);
        balancer.httpServiceBalancerStats.removal(attempt.uri).add(uriState.lastBackoff);
      }
    }
    else {
      uriState.numFailures = 0;
    }
  }
},
origin: com.proofpoint.platform/http-client

  @Override
  public void mark(boolean isFailure, InstanceState uriState, HttpServiceAttemptImpl attempt, HttpServiceBalancerImpl balancer)
  {
    if (isFailure) {
      uriState.liveness = DEAD;
      uriState.backoffPolicy = uriState.backoffPolicy.nextAttempt();
      uriState.lastBackoff = uriState.backoffPolicy.backoff(uriState.lastBackoff);
      uriState.deadUntil = balancer.ticker.read() + uriState.lastBackoff.roundTo(NANOSECONDS);
      balancer.httpServiceBalancerStats.removal(attempt.uri).add(uriState.lastBackoff);
    }
    else {
      uriState.liveness = ALIVE;
      uriState.numFailures = 0;
      uriState.backoffPolicy = null;
      uriState.lastBackoff = null;
      balancer.httpServiceBalancerStats.revival(attempt.uri).add(1);
    }
  }
};
origin: com.proofpoint.platform/http-client

attempt.markBad(e.getFailureCategory());
Duration backoff = attemptBackoffPolicy.backoff(previousBackoff);
long millis = backoff.roundTo(MILLISECONDS);
try {
  Thread.sleep(millis);
origin: com.proofpoint.platform/http-client

}, backoff.roundTo(MILLISECONDS), MILLISECONDS);
subFuture = new RetryDelayFuture<>(scheduledFuture, attempt);
com.proofpoint.unitsDurationroundTo

Popular methods of Duration

  • toMillis
  • <init>
  • nanosSince
  • convertToMostSuccinctTimeUnit
  • getValue
  • compareTo
  • equals
  • hashCode
  • toString
  • valueOf

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JLabel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now