0
我創建了自己的請求,並在構造函數中設置了setShouldCache(Boolean.TRUE);
。Volley CacheDispatcher掛起
當第一次調用請求時(沒有使用緩存),那麼一切都很好,我可以看到緩存的內容。第二次我打電話一個奇怪的事情發生了相同的URL:
else {
// Insert 'null' queue for this cacheKey, indicating there is now a request in
// flight.
mWaitingRequests.put(cacheKey, null);
mCacheQueue.add(request); <-- being called
從RequestQueue.add
提取。
我可以在mCacheQueue
填補了調試器看到,但沒有被從叫,.e.g
從CacheDispatcher.run
提取。
卡住了。
這是創建請求的一段代碼:信息
RequestFuture<String> future = _requestFutureProvider.get();
FetchArticleImageRequest request = new FetchArticleImageRequest(pageId,
300,
future, future);
_requestQueue.add(request);
try {
// this will never block
imgUrl = future.get(3, TimeUnit.SECONDS);
} catch (Exception e) {
log.error("Unable to fetch img url", e);
}
再吃一塊,我正在內的另一個請求parseQueryResponse
要求,因此它不會在主線程中運行。
順便說一下,當不使用緩存時,一切運行良好(例如,對服務器發出請求)。
任何想法是什麼在這裏?