From 9a128540048414c78a2be9524f93b6234c640b3a Mon Sep 17 00:00:00 2001 From: Anonymous Date: Mon, 7 May 2018 11:39:31 -0700 Subject: Import of Volley from GitHub to AOSP. Adds android-support-annotations as a runtime dependency in Android.mk. - 28588322fa4eca3c1a7922b8a2f7b4a97d5c099a Fix concurrent modification errors in ImageContainer. (#1... by Jeff Davidson - ba3b40457a97b3b3812cb00191b41cb0af4149df Fix unchecked operations in Volley build. (#178) by Jeff Davidson - 62c19019e43a76ba4a084b25548e7fb1cfd4a457 Always close HttpURLConnections in HurlStack. (#176) by Jeff Davidson - 36c80f25a78cf2ba2feb2d697f12f9bbca96bf43 Port dispatcher tests to mockito. (#172) by Jeff Davidson - 15b55093fc8ac86902a745f46a2bdea825e797a3 Cleaning up parameter comments + unnecessary generics. (#... by Jeff Davidson - 6b341755e522f23de149544536b9b69c7b7b8305 Remove all wildcard imports. (#170) by Jeff Davidson - a8424005b3ba6d17fc9e123a2176da702f3ead10 Use actual annotations instead of comments. (#169) by Jeff Davidson - bdc80555aee738235bd33c26878bbe8ce382d795 Apply google-java-format to all code. (#165) by Jeff Davidson - 5307293b15dd0c32f53b8f1fd8c198caa443982e Integrate Volley builds with errorprone. (#162) by Jeff Davidson - fa586029500e6813d654f1b454cd3345b0a43897 Fail Travis builds if snapshot uploading fails. (#163) by Jeff Davidson - 0ebb97e9b0192e879088b38b5992158e99364dc6 Stop publishing bintray-info.json. (#141) by Jeff Davidson - b89dfbd2e6964acfe5561e268300611a83957a15 fix: request time contains RequestQueue blocking time. (#... by dezng - c2bfd86596e588c924c2c7e0ae0940053800af5c Guard against illegal argument and OOM exceptions in read... by Joe Bowbeer - fc8ff0423fe9a3af6595088b34f912fb2d920ffb Log fix (#112) by Navid Ht - 47586f0fd42acd5ce09dfc767387df685edfa547 Bump version to 1.1.1-SNAPSHOT. (#123) by Jeff Davidson - 1392f961af17d0f5ba367d8d199a18e5325b882e Update deploy credentials. (#122) by Jeff Davidson - ffe9281709f38f84492ce898603d3ec084326a57 Set project group and version. (#120) by Jeff Davidson GitOrigin-RevId: 28588322fa4eca3c1a7922b8a2f7b4a97d5c099a Change-Id: Ifeea069df2f0a5fd10bc3d4686601c88906ee653 --- .../com/android/volley/DefaultRetryPolicy.java | 28 +++++++--------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'src/main/java/com/android/volley/DefaultRetryPolicy.java') diff --git a/src/main/java/com/android/volley/DefaultRetryPolicy.java b/src/main/java/com/android/volley/DefaultRetryPolicy.java index d8abab0..4be6b50 100644 --- a/src/main/java/com/android/volley/DefaultRetryPolicy.java +++ b/src/main/java/com/android/volley/DefaultRetryPolicy.java @@ -16,9 +16,7 @@ package com.android.volley; -/** - * Default retry policy for requests. - */ +/** Default retry policy for requests. */ public class DefaultRetryPolicy implements RetryPolicy { /** The current timeout in milliseconds. */ private int mCurrentTimeoutMs; @@ -41,15 +39,14 @@ public class DefaultRetryPolicy implements RetryPolicy { /** The default backoff multiplier */ public static final float DEFAULT_BACKOFF_MULT = 1f; - /** - * Constructs a new retry policy using the default timeouts. - */ + /** Constructs a new retry policy using the default timeouts. */ public DefaultRetryPolicy() { this(DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, DEFAULT_BACKOFF_MULT); } /** * Constructs a new retry policy. + * * @param initialTimeoutMs The initial timeout for the policy. * @param maxNumRetries The maximum number of retries. * @param backoffMultiplier Backoff multiplier for the policy. @@ -60,45 +57,38 @@ public class DefaultRetryPolicy implements RetryPolicy { mBackoffMultiplier = backoffMultiplier; } - /** - * Returns the current timeout. - */ + /** Returns the current timeout. */ @Override public int getCurrentTimeout() { return mCurrentTimeoutMs; } - /** - * Returns the current retry count. - */ + /** Returns the current retry count. */ @Override public int getCurrentRetryCount() { return mCurrentRetryCount; } - /** - * Returns the backoff multiplier for the policy. - */ + /** Returns the backoff multiplier for the policy. */ public float getBackoffMultiplier() { return mBackoffMultiplier; } /** * Prepares for the next retry by applying a backoff to the timeout. + * * @param error The error code of the last attempt. */ @Override public void retry(VolleyError error) throws VolleyError { mCurrentRetryCount++; - mCurrentTimeoutMs += (mCurrentTimeoutMs * mBackoffMultiplier); + mCurrentTimeoutMs += (int) (mCurrentTimeoutMs * mBackoffMultiplier); if (!hasAttemptRemaining()) { throw error; } } - /** - * Returns true if this policy has attempts remaining, false otherwise. - */ + /** Returns true if this policy has attempts remaining, false otherwise. */ protected boolean hasAttemptRemaining() { return mCurrentRetryCount <= mMaxNumRetries; } -- cgit v1.2.3