Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release
, bukan aosp-main
, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
RequestUtil
public
class
RequestUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.RequestUtil
|
Utilitas untuk mengizinkan percobaan ulang umum permintaan jaringan dengan penanganan error.
Ringkasan
Metode publik |
static
<T>
T
|
requestWithBackoff( requestMethod)
Panggil permintaan yang ditentukan dengan parameter backoff.
|
static
<T>
T
|
requestWithBackoff( requestMethod, int minWaitMSec, int maxWaitMSec, int scalingFactor)
Panggil permintaan yang ditentukan dengan parameter backoff.
|
static
<T>
T
|
requestWithBackoff( requestMethod, int minWaitMSec, int maxWaitMSec, int scalingFactor, IRunUtil runUtil)
Panggil permintaan yang ditentukan dengan parameter backoff.
|
Konstruktor publik
RequestUtil
public RequestUtil ()
Metode publik
requestWithBackoff
public static T requestWithBackoff ( requestMethod)
Panggil permintaan yang ditentukan dengan parameter backoff.
Menggunakan beberapa parameter pengaturan waktu default.
Parameter |
requestMethod |
: metode yang akan dipanggil untuk membuat permintaan |
requestWithBackoff
public static T requestWithBackoff ( requestMethod,
int minWaitMSec,
int maxWaitMSec,
int scalingFactor)
Panggil permintaan yang ditentukan dengan parameter backoff.
Parameter |
requestMethod |
: metode yang akan dipanggil untuk membuat permintaan |
minWaitMSec |
int : periode terpendek untuk menunggu di antara permintaan |
maxWaitMSec |
int : periode terpanjang untuk menunggu di antara permintaan |
scalingFactor |
int : pengganda yang akan diterapkan ke periode tunggu pada permintaan yang gagal |
requestWithBackoff
public static T requestWithBackoff ( requestMethod,
int minWaitMSec,
int maxWaitMSec,
int scalingFactor,
IRunUtil runUtil)
Panggil permintaan yang ditentukan dengan parameter backoff.
Parameter |
requestMethod |
: metode yang akan dipanggil untuk membuat permintaan |
minWaitMSec |
int : periode terpendek untuk menunggu di antara permintaan |
maxWaitMSec |
int : periode terpanjang untuk menunggu di antara permintaan |
scalingFactor |
int : pengganda yang akan diterapkan ke periode tunggu pada permintaan yang gagal |
runUtil |
IRunUtil : utilitas tidur yang akan digunakan |
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 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 |"]]