Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
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 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 |
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 |
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 |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-10-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-08 UTC."],[],[],null,["# RequestUtil\n===========\n\n\n`\npublic\n\n\nclass\nRequestUtil\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|---------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.util.RequestUtil |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nUtilities to allow generic retry of network requests with error handling.\n\nSummary\n-------\n\n| ### Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------|---|\n| ` `[RequestUtil](../../../../../../reference/tradefed/com/android/tradefed/util/RequestUtil.html#RequestUtil())`() ` |\n\n| ### Public methods ||\n|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static \u003cT\u003e T` | ` `[requestWithBackoff](../../../../../../reference/tradefed/com/android/tradefed/util/RequestUtil.html#requestWithBackoff(\u003cany\u003e))`(` requestMethod) Call the specified request with backoff parameters. |\n| ` static \u003cT\u003e T` | ` `[requestWithBackoff](../../../../../../reference/tradefed/com/android/tradefed/util/RequestUtil.html#requestWithBackoff(\u003cany\u003e,%20int,%20int,%20int))`(` requestMethod, int minWaitMSec, int maxWaitMSec, int scalingFactor) Call the specified request with backoff parameters. |\n| ` static \u003cT\u003e T` | ` `[requestWithBackoff](../../../../../../reference/tradefed/com/android/tradefed/util/RequestUtil.html#requestWithBackoff(\u003cany\u003e,%20int,%20int,%20int,%20com.android.tradefed.util.IRunUtil))`(` requestMethod, int minWaitMSec, int maxWaitMSec, int scalingFactor, [IRunUtil](../../../../../../reference/tradefed/com/android/tradefed/util/IRunUtil.html) runUtil) Call the specified request with backoff parameters. |\n\nPublic constructors\n-------------------\n\n### RequestUtil\n\n```\npublic RequestUtil ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### requestWithBackoff\n\n```\npublic static T requestWithBackoff ( requestMethod)\n```\n\nCall the specified request with backoff parameters.\n\nUses some default timing parameters.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|-------------------------------------------------|\n| `requestMethod` | : the method to call to make the request \u003cbr /\u003e |\n\n| Returns ||\n|-----|--------|\n| `T` | \u003cbr /\u003e |\n\n### requestWithBackoff\n\n```\npublic static T requestWithBackoff ( requestMethod, \n int minWaitMSec, \n int maxWaitMSec, \n int scalingFactor)\n```\n\nCall the specified request with backoff parameters.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|-------------------------------------------------------------------------------|\n| `requestMethod` | : the method to call to make the request \u003cbr /\u003e |\n| `minWaitMSec` | `int`: the shortest period to wait between requests \u003cbr /\u003e |\n| `maxWaitMSec` | `int`: the longest period to wait between requests \u003cbr /\u003e |\n| `scalingFactor` | `int`: the multiple to apply to the waiting period on a failed request \u003cbr /\u003e |\n\n| Returns ||\n|-----|--------|\n| `T` | \u003cbr /\u003e |\n\n### requestWithBackoff\n\n```\npublic static T requestWithBackoff ( requestMethod, \n int minWaitMSec, \n int maxWaitMSec, \n int scalingFactor, \n ../../../../../../reference/tradefed/com/android/tradefed/util/IRunUtil.html runUtil)\n```\n\nCall the specified request with backoff parameters.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|-------------------------------------------------------------------------------|\n| `requestMethod` | : the method to call to make the request \u003cbr /\u003e |\n| `minWaitMSec` | `int`: the shortest period to wait between requests \u003cbr /\u003e |\n| `maxWaitMSec` | `int`: the longest period to wait between requests \u003cbr /\u003e |\n| `scalingFactor` | `int`: the multiple to apply to the waiting period on a failed request \u003cbr /\u003e |\n| `runUtil` | `IRunUtil`: the sleeping utility to use \u003cbr /\u003e |\n\n| Returns ||\n|-----|--------|\n| `T` | \u003cbr /\u003e |"]]