修复monkey测试出现的两个bug

pull/2/head
AriaLyy 8 years ago
parent ea8371262f
commit 29c96ee6d5
  1. 4
      Aria/src/main/java/com/arialyy/aria/core/queue/DownloadTaskQueue.java
  2. 4
      Aria/src/main/java/com/arialyy/aria/core/task/DownloadUtil.java

@ -106,6 +106,10 @@ public class DownloadTaskQueue implements ITaskQueue {
} }
@Override public void reTryStart(Task task) { @Override public void reTryStart(Task task) {
if (task == null){
Log.w(TAG, "重试下载失败,task 为null");
return;
}
if (!task.isDownloading()) { if (!task.isDownloading()) {
task.start(); task.start();
} else { } else {

@ -75,7 +75,7 @@ final class DownloadUtil implements IDownloadUtil {
mDownloadEntity = entity; mDownloadEntity = entity;
mListener = downloadListener; mListener = downloadListener;
THREAD_NUM = threadNum; THREAD_NUM = threadNum;
mFixedThreadPool = Executors.newFixedThreadPool(THREAD_NUM); mFixedThreadPool = Executors.newFixedThreadPool(Integer.MAX_VALUE);
} }
public IDownloadListener getListener() { public IDownloadListener getListener() {
@ -292,7 +292,7 @@ final class DownloadUtil implements IDownloadUtil {
for (int l : recordL) { for (int l : recordL) {
if (l == -1) continue; if (l == -1) continue;
Runnable task = mTask.get(l); Runnable task = mTask.get(l);
if (task != null) { if (task != null && !mFixedThreadPool.isShutdown()) {
mFixedThreadPool.execute(task); mFixedThreadPool.execute(task);
} }
} }

Loading…
Cancel
Save