Merge branch 'v_2.0' of https://github.com/AriaLyy/Aria into v_2.0

This commit is contained in:
AriaLyy
2017-01-18 09:43:49 +08:00
2 changed files with 7 additions and 10 deletions

View File

@ -171,13 +171,10 @@ public class DownloadTaskQueue implements ITaskQueue {
Task task = mExecutePool.getTask(entity.getDownloadUrl());
if (task != null) {
Log.d(TAG, "从执行池删除任务,删除" + (mExecutePool.removeTask(task) ? "成功" : "失败"));
} else {
task = mCachePool.getTask(entity.getDownloadUrl());
}
task = mCachePool.getTask(entity.getDownloadUrl());
if (task != null) {
Log.d(TAG, "从缓存池删除任务,删除" + (mCachePool.removeTask(task) ? "成功" : "失败"));
} else {
Log.w(TAG, "没有找到下载链接为【" + entity.getDownloadUrl() + "】的任务");
}
}

View File

@ -121,15 +121,16 @@ public class DownloadSchedulers implements IDownloadSchedulers {
case STOP:
case CANCEL:
mQueue.removeTask(entity);
mQueue.removeTask(entity);
if (mQueue.size() != Configuration.getInstance().getDownloadNum()) {
if (mQueue.size() < Configuration.getInstance().getDownloadNum()) {
startNextTask(entity);
}
break;
case COMPLETE:
mQueue.removeTask(entity);
startNextTask(entity);
break;
case FAIL:
mQueue.removeTask(entity);
handleFailTask(entity);
break;
}
@ -223,7 +224,6 @@ public class DownloadSchedulers implements IDownloadSchedulers {
* @param entity 通过Handler传递的下载实体
*/
@Override public void startNextTask(DownloadEntity entity) {
mQueue.removeTask(entity);
Task newTask = mQueue.getNextTask();
if (newTask == null) {
Log.w(TAG, "没有下一任务");