com.android.volley
Class DefaultRetryPolicy

java.lang.Object
  extended by com.android.volley.DefaultRetryPolicy
All Implemented Interfaces:
RetryPolicy

public class DefaultRetryPolicy
extends Object
implements RetryPolicy

Default retry policy for requests.


Field Summary
static float DEFAULT_BACKOFF_MULT
          The default backoff multiplier
static int DEFAULT_MAX_RETRIES
          The default number of retries
static int DEFAULT_TIMEOUT_MS
          The default socket timeout in milliseconds
 
Constructor Summary
DefaultRetryPolicy()
          Constructs a new retry policy using the default timeouts.
DefaultRetryPolicy(int initialTimeoutMs, int maxNumRetries, float backoffMultiplier)
          Constructs a new retry policy.
 
Method Summary
 int getCurrentRetryCount()
          Returns the current retry count.
 int getCurrentTimeout()
          Returns the current timeout.
protected  boolean hasAttemptRemaining()
          Returns true if this policy has attempts remaining, false otherwise.
 void retry(VolleyError error)
          Prepares for the next retry by applying a backoff to the timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT_MS

public static final int DEFAULT_TIMEOUT_MS
The default socket timeout in milliseconds

See Also:
Constant Field Values

DEFAULT_MAX_RETRIES

public static final int DEFAULT_MAX_RETRIES
The default number of retries

See Also:
Constant Field Values

DEFAULT_BACKOFF_MULT

public static final float DEFAULT_BACKOFF_MULT
The default backoff multiplier

See Also:
Constant Field Values
Constructor Detail

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.

Parameters:
initialTimeoutMs - The initial timeout for the policy.
maxNumRetries - The maximum number of retries.
backoffMultiplier - Backoff multiplier for the policy.
Method Detail

getCurrentTimeout

public int getCurrentTimeout()
Returns the current timeout.

Specified by:
getCurrentTimeout in interface RetryPolicy

getCurrentRetryCount

public int getCurrentRetryCount()
Returns the current retry count.

Specified by:
getCurrentRetryCount in interface RetryPolicy

retry

public void retry(VolleyError error)
           throws VolleyError
Prepares for the next retry by applying a backoff to the timeout.

Specified by:
retry in interface RetryPolicy
Parameters:
error - The error code of the last attempt.
Throws:
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.