Prepares for the next retry by applying a backoff to the timeout.

@param error The error code of the last attempt.
181401
@Override
  public void retry(VolleyError error) throws VolleyError {
    currentRetryCount++;
    currentTimeoutMs += (currentTimeoutMs * backoffMultiplier);
    if (!hasAttemptRemaining()) {
      throw error;
    }
  }
1363993
private static void attemptRetryOnException(String logPrefix, Request<?> request,
            VolleyError exception) throws VolleyError {
        RetryPolicy retryPolicy = request.getRetryPolicy();
        int oldTimeout = request.getTimeoutMs();

        try {
            retryPolicy.retry(exception);
        } catch (VolleyError e) {
            request.addMarker(
                    String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
            throw e;
        }
        request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
    }
968932
public Retryer<R> timeout(final TimeLimiter timeLimiter, final long duration, final TimeUnit timeUnit) {
        return withTimelimiter(new AttemptTimelimit<R>() {

            @Override public R call(Callable<R> callable) throws Exception {
                return checkNotNull(timeLimiter, "TimeLimiter cannot be null")
                        .callWithTimeout(callable, duration, checkNotNull(timeUnit), true);
            }
        });
    }
457338
def should_retry_on_error(self, error):
        

        if self.is_streaming_request:
            # not retry for streaming request
            return False

        retry_flag = self.headers.get('re', retry.DEFAULT)

        if retry_flag == retry.NEVER:
            return False

        if isinstance(error, StreamClosedError):
            return True

        if error.code in [ErrorCode.bad_request, ErrorCode.cancelled,
                          ErrorCode.unhealthy]:
            return False
        elif error.code in [ErrorCode.busy, ErrorCode.declined]:
            return True
        elif error.code is ErrorCode.timeout:
            return retry_flag is not retry.CONNECTION_ERROR
        elif error.code in [ErrorCode.network_error,
                            ErrorCode.fatal,
                            ErrorCode.unexpected]:
            return retry_flag is not retry.TIMEOUT
        else:
            return False
371171
function throwTimeoutError(resp) {
  let err = new Error('timeout');
  err.type = 'timeout';
  err.response = resp;
  err.url = resp.url;
  throw err;
}
297542
def http_retry_with_backoff_middleware(
        make_request,
        web3,  # pylint: disable=unused-argument
        errors: Tuple = (
            exceptions.ConnectionError,
            exceptions.HTTPError,
            exceptions.Timeout,
            exceptions.TooManyRedirects,
        ),
        retries: int = 10,
        first_backoff: float = 0.2,
        backoff_factor: float = 2,
):
    
    def middleware(method, params):
        backoff = first_backoff
        if check_if_retry_on_failure(method):
            for i in range(retries):
                try:
                    return make_request(method, params)
                except errors:
                    if i < retries - 1:
                        gevent.sleep(backoff)
                        backoff *= backoff_factor
                        continue
                    else:
                        raise
        else:
            return make_request(method, params)

    return middleware
1161636
public static Function<Flux<Throwable>, Publisher<?>> exponentialBackOffError(Duration minimum, Duration maximum, Duration timeout) {
        Instant finish = Instant.now().plus(timeout);
        return errors -> getDelay(minimum, maximum, finish, errors.zipWith(Flux.range(0, Integer.MAX_VALUE), (error, iteration) -> iteration.longValue()));
    }
498036
function timeOutError(response, message, body) {
  var content = errorContent(ErrorType.connection, message, body);
  send(response, content, StatusCode.timeout);
}
100689
private void abort(Error error) {
    try {
      if (mContext == null || mContext.getError() != null || mContext.isDoneUnsafe()) {
        // Note, we may reach here via events due to network errors bubbling up before
        // mContext is initialized, or stream error after the request is finished.
        return;
      }
      mContext.setError(error);
      cleanupRequest(mContext);
      replyError();
    } catch (Exception e) {
      LOG.warn("Failed to cleanup states with error {}.", e.getMessage());
    }
  }
773355
public RetryTemplateBuilder fixedBackoff(long interval) {
		Assert.isNull(this.backOffPolicy, "You have already selected backoff policy");
		Assert.isTrue(interval >= 1, "Interval should be >= 1");
		FixedBackOffPolicy policy = new FixedBackOffPolicy();
		policy.setBackOffPeriod(interval);
		this.backOffPolicy = policy;
		return this;
	}
604183
private function backOff()
  {
    $delay = $this->getDelay();

    $this->client->getLogger()->debug(
        'Retrying task with backoff',
        array(
            'request' => $this->name,
            'retry' => $this->attempts,
            'backoff_seconds' => $delay
        )
    );

    usleep($delay * 1000000);
  }
1248243
@SuppressWarnings("unchecked")
	@Override
	public T retry(final int count, final int waitTime) {
		context().setMaxRetryCount(count).setRetryWaitTime(waitTime);
		return (T) this;
	}
933392
public void wait(int retry) {
        long sleepMillis = BACKOFF[Math.min(retry, BACKOFF.length - 1)] * 1000L;
        try {
            Thread.sleep(sleepMillis);
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
            throw new WebbException(ie);
        }
    }
238876
@Override
    public final void complete(Object res, Object error) {
        this.result = res;
        Object prevErr = this.error;
        this.error = error;
        while( !lock.compareAndSet(false,true) ) {}
        try {
            if (hadResult) {
                if ( prevErr instanceof Timeout ) {
                    this.error = prevErr;
                    lock.set(false);
                    return;
                }
                lock.set(false);
                throw new RuntimeException("Double result received on future prevErr:" + prevErr +" (res,err) "+res+","+error );
            }
            hadResult = true;
            if (resultReceiver != null) {
                if (hasFired) {
                    lock.set(false);
                    throw new RuntimeException("Double fire on callback");
                }
                hasFired = true;
                lock.set(false);
                resultReceiver.complete(result, error);
                resultReceiver = null;
                while (!lock.compareAndSet(false, true)) {
                }
                if (nextFuture != null) {
                    lock.set(false);
                    nextFuture.complete(result, error);
                }
                return;
            }
        } finally {
            lock.set(false);
        }
    }
694656
protected void retryDelay(int attemptCount) {
        if (attemptCount > 0) {
            try {
                Thread.sleep(attemptCount * retryDelay);
            } catch (InterruptedException e) {
                LOG.debug("Failed to sleep: " + e, e);
            }
        }
    }
278286
public void deliverError(JusError error) {
        synchronized (errorListeners) {
            for (RequestListener.ErrorListener errorListener : errorListeners) {
                errorListener.onError(error);
            }
            errorListeners.clear();
        }
        synchronized (responseListeners) {
            responseListeners.clear();
        }
    }
417612
private void serveError(Status status, String error, RequestHandler requestHandler) throws IOException {
    this.serveError(status, HTTPTrackerErrorMessage.craft(error), requestHandler);
  }