Java 类com.android.volley.RetryPolicy 实例源码

项目:RestVolley    文件:RVNetwork.java   
/**
 * 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();
}
项目:AyoSunny    文件:BasicNetwork.java   
/**
 * 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));
}
项目:FMTech    文件:BasicNetwork.java   
private static void attemptRetryOnException(String paramString, Request<?> paramRequest, VolleyError paramVolleyError)
  throws VolleyError
{
  RetryPolicy localRetryPolicy = paramRequest.mRetryPolicy;
  int i = paramRequest.getTimeoutMs();
  try
  {
    localRetryPolicy.retry(paramVolleyError);
    Object[] arrayOfObject2 = new Object[2];
    arrayOfObject2[0] = paramString;
    arrayOfObject2[1] = Integer.valueOf(i);
    paramRequest.addMarker(String.format("%s-retry [timeout=%s]", arrayOfObject2));
    return;
  }
  catch (VolleyError localVolleyError)
  {
    Object[] arrayOfObject1 = new Object[2];
    arrayOfObject1[0] = paramString;
    arrayOfObject1[1] = Integer.valueOf(i);
    paramRequest.addMarker(String.format("%s-timeout-giveup [timeout=%s]", arrayOfObject1));
    throw localVolleyError;
  }
}
项目:BookMySkills    文件:BasicNetwork.java   
/**
 * 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));
}
项目:Projectile    文件:ProjectileRequest.java   
public ProjectileRequest(int method, String url, Map<String, String> headers, Map<String, String> params, final ResponseListener<T> responseListener, Priority p, RetryPolicy retryPolicy, Object tag, boolean shouldCache) {
    super(method, url, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError volleyError) {
            if(responseListener != null) responseListener.onError(volleyError);
        }
    });

    mListener = responseListener;
    mHeaders = headers;
    mParams = params;
    mPriority = p;
    setRetryPolicy(retryPolicy);
    setTag(tag);
    setShouldCache(shouldCache);
}
项目:egg-android    文件:OkHttpNetwork.java   
/**
     * 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));
    }
项目:GitHub    文件:BasicNetwork.java   
/**
 * 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));
}
项目:GitHub    文件:BasicNetwork.java   
/**
 * 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));
}
项目:publicProject    文件:BasicNetwork.java   
/**
 * 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));
}
项目:super-volley    文件:BasicNetwork.java   
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));
}
项目:Codeforces    文件:BasicNetwork.java   
/**
 * 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));
}
项目:GeekZone    文件:BasicNetwork.java   
/**
 * 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));
}
项目:GeekZone    文件:BaseNetwork.java   
/**
 * 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));
}
项目:iosched-reader    文件:BasicNetwork.java   
/**
 * 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));
}
项目:boohee_v5.6    文件:BasicNetwork.java   
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;
    }
}
项目:Spitfire    文件:SpitfireManager.java   
/**
 * Generate a default retry policy (30 seconds for the timeout, 1 retry maximum, 1 backoff multiplier)
 * @return a default retry policy, not null
 */
@NonNull
private static RetryPolicy generateRetryPolicy() {
    return new DefaultRetryPolicy(requestTimeout,
            DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
}
项目:EsperantoRadio    文件:DrBasicNetwork.java   
/**
 * 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));
}
项目:VoV    文件:BasicNetwork.java   
/**
 * 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));
}
项目:smconf-android    文件:BasicNetwork.java   
/**
 * 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));
}
项目:volley    文件:BasicNetwork.java   
/**
 * 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));
}
项目:RealArchitecture    文件:VolleyClient.java   
/**
 * 如果传入的tag有效,则可以通过该tag取消请求的发送
 *
 * @param request    req
 * @param requestTag tag
 */
private void makeRequest(VolleyRequest request, String requestTag) {
    if (!TextUtils.isEmpty(requestTag)) {
        request.setTag(requestTag);
    }
    // step4:放入请求队列
    RequestQueue requestQueue = VolleyManager.getInstance(mContext).getRequestQueue();
    int socketTimeout = 5000;//30 seconds - change to what you want
    RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    request.setRetryPolicy(policy);
    requestQueue.add(request);
}
项目:RestVolley    文件:RestVolleyRequest.java   
/**
 * set the retry policy, default is {@link DefaultRetryPolicy()}.
 * @param retryPolicy see {@link DefaultRetryPolicy}
 * @return {@link RestVolleyRequest}
 * @see Request#setRetryPolicy(RetryPolicy)
 */
public R setRetryPolicy(RetryPolicy retryPolicy) {
    if (mRetryPolicy != null) {
        mRetryPolicy = retryPolicy;
    }
    return (R)this;
}
项目:InfoQ-Android-App    文件:BasicNetwork.java   
/**
 * 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));
}
项目:volley-public-key-pinning    文件:BasicNetwork.java   
/**
 * 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));
}
项目:device-database    文件:BasicNetwork.java   
/**
 * 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));
}
项目:ShoppingApp    文件:BasicNetwork.java   
/**
 * 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));
}
项目:GoApp2    文件:BasicNetwork.java   
/**
 * 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));
}
项目:2015-Google-I-O-app    文件:BasicNetwork.java   
/**
 * 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));
}
项目:msb-android    文件:BasicNetwork.java   
/**
 * 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));
}
项目:Simplified-Zhihu-Daily    文件:BasicNetwork.java   
/**
 * 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));
}
项目:SimplifyReader2    文件:BasicNetwork.java   
/**
 * 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));
}
项目:TastySnake    文件:BasicNetwork.java   
/**
 * 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));
}
项目:SaveVolley    文件:BasicNetwork.java   
/**
 * 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));
}
项目:SaveVolley    文件:RequestTest.java   
@Test public void publicMethods() throws Exception {
    // Catch-all test to find API-breaking changes.
    assertNotNull(Request.class.getConstructor(int.class, String.class,
            Response.ErrorListener.class));

    assertNotNull(Request.class.getMethod("getMethod"));
    assertNotNull(Request.class.getMethod("setTag", Object.class));
    assertNotNull(Request.class.getMethod("getTag"));
    assertNotNull(Request.class.getMethod("getErrorListener"));
    assertNotNull(Request.class.getMethod("getTrafficStatsTag"));
    assertNotNull(Request.class.getMethod("setRetryPolicy", RetryPolicy.class));
    assertNotNull(Request.class.getMethod("addMarker", String.class));
    assertNotNull(Request.class.getDeclaredMethod("finish", String.class));
    assertNotNull(Request.class.getMethod("setRequestQueue", RequestQueue.class));
    assertNotNull(Request.class.getMethod("setSequence", int.class));
    assertNotNull(Request.class.getMethod("getSequence"));
    assertNotNull(Request.class.getMethod("getUrl"));
    assertNotNull(Request.class.getMethod("getCacheKey"));
    assertNotNull(Request.class.getMethod("setCacheEntry", Cache.Entry.class));
    assertNotNull(Request.class.getMethod("getCacheEntry"));
    assertNotNull(Request.class.getMethod("cancel"));
    assertNotNull(Request.class.getMethod("isCanceled"));
    assertNotNull(Request.class.getMethod("getHeaders"));
    assertNotNull(Request.class.getDeclaredMethod("getParams"));
    assertNotNull(Request.class.getDeclaredMethod("getParamsEncoding"));
    assertNotNull(Request.class.getMethod("getBodyContentType"));
    assertNotNull(Request.class.getMethod("getBody"));
    assertNotNull(Request.class.getMethod("setShouldCache", boolean.class));
    assertNotNull(Request.class.getMethod("shouldCache"));
    assertNotNull(Request.class.getMethod("getPriority"));
    assertNotNull(Request.class.getMethod("getTimeoutMs"));
    assertNotNull(Request.class.getMethod("getRetryPolicy"));
    assertNotNull(Request.class.getMethod("markDelivered"));
    assertNotNull(Request.class.getMethod("hasHadResponseDelivered"));
    assertNotNull(
            Request.class.getDeclaredMethod("parseNetworkResponse", NetworkResponse.class));
    assertNotNull(Request.class.getDeclaredMethod("parseNetworkError", VolleyError.class));
    assertNotNull(Request.class.getDeclaredMethod("deliverResponse", Object.class));
    assertNotNull(Request.class.getMethod("deliverError", VolleyError.class));
}
项目:Jacket-    文件:BasicNetwork.java   
/**
 * 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));
}
项目:android-project-wo2b    文件:BasicNetwork.java   
/**
 * 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));
}
项目:ots15-companion    文件:BasicNetwork.java   
/**
 * 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));
}
项目:FMTech    文件:DfeRequest.java   
public final Map<String, String> getHeaders()
  throws AuthFailureError
{
  Map localMap = this.mApiContext.getHeaders();
  if (this.mExtraHeaders != null) {
    localMap.putAll(this.mExtraHeaders);
  }
  if (this.mResponseVerifier != null) {}
  try
  {
    localMap.put("X-DFE-Signature-Request", this.mResponseVerifier.getSignatureRequest());
    RetryPolicy localRetryPolicy = this.mRetryPolicy;
    String str = "timeoutMs=" + localRetryPolicy.getCurrentTimeout();
    int i = localRetryPolicy.getCurrentRetryCount();
    if (i > 0) {
      str = str + "; retryAttempt=" + i;
    }
    localMap.put("X-DFE-Request-Params", str);
    return localMap;
  }
  catch (DfeResponseVerifier.DfeResponseVerifierException localDfeResponseVerifierException)
  {
    for (;;)
    {
      PlayCommonLog.d("Couldn't create signature request: %s", new Object[] { localDfeResponseVerifierException });
      cancel();
    }
  }
}
项目:FMTech    文件:BasicNetwork.java   
/**
 * 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));
}
项目:SimplifyReader    文件:BasicNetwork.java   
/**
 * 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));
}