You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * Prepares for the next retry by applying a backoff to the timeout. * @param error The error code of the last attempt. */ @Override public void retry(VolleyError error) throws VolleyError { mCurrentRetryCount++; mCurrentTimeoutMs += (mCurrentTimeoutMs * mBackoffMultiplier); if (!hasAttemptRemaining()) { throw error; } }
request = null; try { // Take a request from the queue. request = mQueue.take(); } catch (InterruptedException e) { // We may have been interrupted because it was time to quit. if (mQuit) { return; } continue; }
不知道楼主现在是否记得请求重发这一块的逻辑,看源码找了半天都没有找到
/** * Prepares for the next retry by applying a backoff to the timeout. * @param error The error code of the last attempt. */ @Override public void retry(VolleyError error) throws VolleyError { mCurrentRetryCount++; mCurrentTimeoutMs += (mCurrentTimeoutMs * mBackoffMultiplier); if (!hasAttemptRemaining()) { throw error; } }
上面这块代码是 NetworkDispatcher 中 run方法的实现
下面是DefaultRetryPolicy里面当中的代码,但是在这个代码中没有看到它把请求添加到请求队列当中。
request = null; try { // Take a request from the queue. request = mQueue.take(); } catch (InterruptedException e) { // We may have been interrupted because it was time to quit. if (mQuit) { return; } continue; }
这个请求在真正发送之前就从队列里面拿出来了,但是在重试的时候又没有放进去。
所以请教一下楼主知不知道Volley请求重发的核心代码,谢谢!
需要重发的请求是否放到了请求的队列当中,如果放进去了是在哪里放进去的,如果没有放到请求队列当中,那么这个重发的请求又是如何实现的?
The text was updated successfully, but these errors were encountered: