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