Open itsgm opened 4 years ago
FileDownloadSerialQueue queue = new FileDownloadSerialQueue(); FileDownloader.enableAvoidDropFrame();//避免掉帧 for (int i = 0; i < 10; i++) { BaseDownloadTask baseDownloadTask = FileDownloader .getImpl() .create(Constant.URLS[i]) .setAutoRetryTimes(3) .setCallbackProgressTimes(0) .setPath(FileDownloadUtils.getDefaultSaveRootPath()+ "/" + i) .setTag(i) .addFinishListener(new BaseDownloadTask.FinishListener() { @Override public void over(BaseDownloadTask task) { if(task.getStatus() == FileDownloadStatus.completed) LogUtils.debugInfo("sgm", "====completed:" + (int) task.getTag()); } }); queue.enqueue(baseDownloadTask); }
代码是这样写的,经常出现只下载了5,6条完成,而没有下载10条数据,是不是线程阻塞了?
我也出现了类似情况,每次下载两三个文件,但是最终只有一个文件
FileDownloadSerialQueue queue = new FileDownloadSerialQueue(); FileDownloader.enableAvoidDropFrame();//避免掉帧 for (int i = 0; i < 10; i++) { BaseDownloadTask baseDownloadTask = FileDownloader .getImpl() .create(Constant.URLS[i]) .setAutoRetryTimes(3) .setCallbackProgressTimes(0) .setPath(FileDownloadUtils.getDefaultSaveRootPath()+ "/" + i) .setTag(i) .addFinishListener(new BaseDownloadTask.FinishListener() { @Override public void over(BaseDownloadTask task) { if(task.getStatus() == FileDownloadStatus.completed) LogUtils.debugInfo("sgm", "====completed:" + (int) task.getTag()); } }); queue.enqueue(baseDownloadTask); }
代码是这样写的,经常出现只下载了5,6条完成,而没有下载10条数据,是不是线程阻塞了?