Google Data APIs Client Library (1.41.1)



com.google.gdata.client.uploader
Interface BackoffPolicy


public interface BackoffPolicy

Policy class for determining how long to wait before retrying an HTTP request.


Field Summary
static BackoffPolicy DEFAULT
          Default backoff policy with a factor of 2, starting at 500ms and getting capped at 64000ms.
static long STOP
          Value indicating that no more retries should be made, getNextBackoffMs().
 
Method Summary
 long getNextBackoffMs()
          Gets the number of milliseconds to wait before retrying an HTTP request.
 void reset()
          Resets the policy to begin from its initial state.
 

Field Detail

DEFAULT

static final BackoffPolicy DEFAULT
Default backoff policy with a factor of 2, starting at 500ms and getting capped at 64000ms.


STOP

static final long STOP
Value indicating that no more retries should be made, getNextBackoffMs().

See Also:
Constant Field Values
Method Detail

getNextBackoffMs

long getNextBackoffMs()
Gets the number of milliseconds to wait before retrying an HTTP request. If STOP is returned, no retries should be made. This method should be used as follows:
   long backoffTime = backoffPolicy.getNextBackoffMs();
   if (backoffTime = BackoffPolicy.STOP) {
     // Stop retrying.
   } else {
     // Retry after backoffTime.
   }
 

Returns:
the number of milliseconds to wait when backing off requests, or STOP if no more retries should be made

reset

void reset()
Resets the policy to begin from its initial state.