类 DefaultRetryPolicy

java.lang.Object
com.android.volley.DefaultRetryPolicy
所有已实现的接口:
RetryPolicy

public class DefaultRetryPolicy extends Object implements RetryPolicy
Default retry policy for requests.
  • 字段详细资料

    • DEFAULT_TIMEOUT_MS

      public static final int DEFAULT_TIMEOUT_MS
      The default socket timeout in milliseconds
      另请参阅:
    • DEFAULT_MAX_RETRIES

      public static final int DEFAULT_MAX_RETRIES
      The default number of retries
      另请参阅:
    • DEFAULT_BACKOFF_MULT

      public static final float DEFAULT_BACKOFF_MULT
      The default backoff multiplier
      另请参阅:
  • 构造器详细资料

    • DefaultRetryPolicy

      public DefaultRetryPolicy()
      Constructs a new retry policy using the default timeouts.
    • DefaultRetryPolicy

      public DefaultRetryPolicy(int initialTimeoutMs, int maxNumRetries, float backoffMultiplier)
      Constructs a new retry policy.
      参数:
      initialTimeoutMs - The initial timeout for the policy.
      maxNumRetries - The maximum number of retries.
      backoffMultiplier - Backoff multiplier for the policy.
  • 方法详细资料

    • getCurrentTimeout

      public int getCurrentTimeout()
      Returns the current timeout.
      指定者:
      getCurrentTimeout 在接口中 RetryPolicy
    • getCurrentRetryCount

      public int getCurrentRetryCount()
      Returns the current retry count.
      指定者:
      getCurrentRetryCount 在接口中 RetryPolicy
    • getBackoffMultiplier

      public float getBackoffMultiplier()
      Returns the backoff multiplier for the policy.
    • retry

      public void retry(VolleyError error) throws VolleyError
      Prepares for the next retry by applying a backoff to the timeout.
      指定者:
      retry 在接口中 RetryPolicy
      参数:
      error - The error code of the last attempt.
      抛出:
      VolleyError - In the event that the retry could not be performed (for example if we ran out of attempts), the passed in error is thrown.
    • hasAttemptRemaining

      protected boolean hasAttemptRemaining()
      Returns true if this policy has attempts remaining, false otherwise.