本文整理匯總了Java中com.android.volley.RetryPolicy.retry方法的典型用法代碼示例。如果您正苦於以下問題:Java RetryPolicy.retry方法的具體用法?Java RetryPolicy.retry怎麽用?Java RetryPolicy.retry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.android.volley.RetryPolicy
的用法示例。
在下文中一共展示了RetryPolicy.retry方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
* @param request The request to use.
*/
protected static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
//reentry the requestQueue
RequestQueue requestQueue = getRequestQueue(request);
if (requestQueue != null) {
requestQueue.add(request);
}
throw new RetryError();
}
示例2: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more
* attempts remaining in the request's retry policy, a timeout exception is
* thrown.
*
* @param request
* The request to use.
*/
private static void attemptRetryOnException(String logPrefix,
Request<?> request, VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]",
logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix,
oldTimeout));
}
示例3: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
*
* @param request The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request,
VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = retryPolicy.getCurrentTimeout();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
// request.addMarker(
// String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
Log.d("network", String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
Log.d("network", String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
//request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例4: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
* @param request The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request,
VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(
String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例5: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
private static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError var6) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw var6;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例6: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
*
* @param request The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception)
throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例7: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
private static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
request.addMarker(String.format("%s-retry [timeout=%s]", new Object[]{logPrefix, Integer.valueOf(oldTimeout)}));
} catch (VolleyError e) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]", new Object[]{logPrefix, Integer.valueOf(oldTimeout)}));
throw e;
}
}
示例8: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
* @param request The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request,
VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(
String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例9: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
*
* @param request The request to use.
*/
/*
* 嘗試 重試策略 處理
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception)
throws VolleyError {
// 拿到 該請求 Request 內對應的 重試策略 類
RetryPolicy retryPolicy = request.getRetryPolicy();
// 獲取請求此次的超時時間
int oldTimeout = request.getTimeoutMs();
try {
/*
* 進行 重試:
* 根據 請求此次的超時時間 * 退避乘數 = 此次的實際超時時間
* 將 實際超時時間 累加到 重試策略類 中的 超時總時長 內
*/
retryPolicy.retry(exception);
} catch (VolleyError e) {
// 打印 log
request.addMarker(
String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
// 打印 log
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例10: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
*
* @param request The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例11: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more attempts remaining in the
* request's retry policy, a timeout exception is thrown.
*
* @param request The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request,
VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(
String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}
示例12: attemptRetryOnException
import com.android.volley.RetryPolicy; //導入方法依賴的package包/類
/**
* Attempts to prepare the request for a retry. If there are no more
* attempts remaining in the request's retry policy, a timeout exception is
* thrown.
*
* @param request
* The request to use.
*/
private static void attemptRetryOnException(String logPrefix, Request<?> request, VolleyError exception) throws VolleyError {
RetryPolicy retryPolicy = request.getRetryPolicy();
int oldTimeout = request.getTimeoutMs();
try {
retryPolicy.retry(exception);
} catch (VolleyError e) {
request.addMarker(String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
throw e;
}
request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
}