@Override protected void configure() { requireBinding(CommandLineArguments.class); bind(GmailService.class).in(Singleton.class); bind(Credential.class) .toProvider(Authorizer.class) .in(Singleton.class); bind(ExponentialBackOff.Builder.class) .toInstance(new ExponentialBackOff.Builder() .setInitialIntervalMillis(1000) .setMultiplier(2) .setRandomizationFactor(0.5) .setMaxIntervalMillis(60000) .setMaxElapsedTimeMillis(300000)); }
.setInitialIntervalMillis(100) .setMultiplier(1.3) .setMaxIntervalMillis(Ints.checkedCast(TimeUnit.SECONDS.toMillis(60)))
/** {@inheritDoc} */ @Override public void waitForReplication(BigtableTableName tableName, long timeout) throws InterruptedException, TimeoutException { // A backoff that randomizes with an interval of 10s. ExponentialBackOff backOff = new ExponentialBackOff.Builder() .setInitialIntervalMillis(10 * 1000) .setMaxIntervalMillis(10 * 1000) .setMaxElapsedTimeMillis(Ints.checkedCast(timeout * 1000)) .build(); waitForReplication(tableName, backOff); }
.setMaxElapsedTimeMillis(maxWaitMillis) .setMaxIntervalMillis(500) .setInitialIntervalMillis(100) .setMultiplier(1.5) .setRandomizationFactor(0.15)
new ExponentialBackOff.Builder() .setMaxIntervalMillis(POLL_WAIT_INTERVAL_MAX_MILLIS) .setInitialIntervalMillis(POLL_WAIT_INITIAL_MILLIS) .setMaxElapsedTimeMillis(POLL_WAIT_MAX_ELAPSED_MILLIS) .build();
/** Creates new generic BackOff used for retries. */ @VisibleForTesting ExponentialBackOff createBackOff() { return new ExponentialBackOff.Builder() .setInitialIntervalMillis(readOptions.getBackoffInitialIntervalMillis()) .setRandomizationFactor(readOptions.getBackoffRandomizationFactor()) .setMultiplier(readOptions.getBackoffMultiplier()) .setMaxIntervalMillis(readOptions.getBackoffMaxIntervalMillis()) .setMaxElapsedTimeMillis(readOptions.getBackoffMaxElapsedTimeMillis()) .setNanoClock(clock) .build(); }
/** * Returns {@link BackOff} instance used for implementing exponential back off for failed * requests. */ @Override public BackOff createBackOffInstance() { return new ExponentialBackOff.Builder() .setInitialIntervalMillis(INITIAL_DELAY_SECONDS * 1000) .setMultiplier(MULTIPLIER) .build(); } }
private static ExponentialBackOff newBackOff() { return new ExponentialBackOff.Builder() .setInitialIntervalMillis(MIN_BACKOFF_MS) .setMaxIntervalMillis(MAX_BACKOFF_MS) .setMaxElapsedTimeMillis(Integer.MAX_VALUE) // Prevent Backoff.STOP from getting returned. .build(); }
public BackOffUtil(boolean isExponential) { if (isExponential) { // aggressive backOff = new ExponentialBackOff.Builder() .setInitialIntervalMillis(2) .setMaxElapsedTimeMillis(Integer.MAX_VALUE) .setMaxIntervalMillis(Integer.MAX_VALUE) .setMultiplier(1.5) .setRandomizationFactor(0) .build(); } else { // conservative backOff = new FixedBackOff(); } }
private static ExponentialBackOff newBackOff() { return new ExponentialBackOff.Builder() .setInitialIntervalMillis(MIN_BACKOFF_MS) .setMaxIntervalMillis(MAX_BACKOFF_MS) .setMaxElapsedTimeMillis(Integer.MAX_VALUE) // Prevent Backoff.STOP from getting returned. .build(); }