RequestUtil

public class RequestUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.RequestUtil


Utilities to allow generic retry of network requests with error handling.

Summary

Public constructors

RequestUtil()

Public methods

static <T> T requestWithBackoff( requestMethod)

Call the specified request with backoff parameters.

static <T> T requestWithBackoff( requestMethod, int minWaitMSec, int maxWaitMSec, int scalingFactor)

Call the specified request with backoff parameters.

static <T> T requestWithBackoff( requestMethod, int minWaitMSec, int maxWaitMSec, int scalingFactor, IRunUtil runUtil)

Call the specified request with backoff parameters.

Public constructors

RequestUtil

public RequestUtil ()

Public methods

requestWithBackoff

public static T requestWithBackoff ( requestMethod)

Call the specified request with backoff parameters.

Uses some default timing parameters.

Parameters
requestMethod : the method to call to make the request

Returns
T

requestWithBackoff

public static T requestWithBackoff ( requestMethod, 
                int minWaitMSec, 
                int maxWaitMSec, 
                int scalingFactor)

Call the specified request with backoff parameters.

Parameters
requestMethod : the method to call to make the request

minWaitMSec int: the shortest period to wait between requests

maxWaitMSec int: the longest period to wait between requests

scalingFactor int: the multiple to apply to the waiting period on a failed request

Returns
T

requestWithBackoff

public static T requestWithBackoff ( requestMethod, 
                int minWaitMSec, 
                int maxWaitMSec, 
                int scalingFactor, 
                IRunUtil runUtil)

Call the specified request with backoff parameters.

Parameters
requestMethod : the method to call to make the request

minWaitMSec int: the shortest period to wait between requests

maxWaitMSec int: the longest period to wait between requests

scalingFactor int: the multiple to apply to the waiting period on a failed request

runUtil IRunUtil: the sleeping utility to use

Returns
T