|
|
@ -130,8 +130,7 @@ public class DownloadSchedulers implements IDownloadSchedulers { |
|
|
|
startNextTask(entity); |
|
|
|
startNextTask(entity); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case FAIL: |
|
|
|
case FAIL: |
|
|
|
mQueue.removeTask(entity); |
|
|
|
handleFailTask(task); |
|
|
|
handleFailTask(entity); |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -192,9 +191,9 @@ public class DownloadSchedulers implements IDownloadSchedulers { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 处理下载任务下载失败的情形 |
|
|
|
* 处理下载任务下载失败的情形 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param entity 失败实体 |
|
|
|
* @param task 下载任务 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override public void handleFailTask(final DownloadEntity entity) { |
|
|
|
@Override public void handleFailTask(final Task task) { |
|
|
|
final Configuration config = Configuration.getInstance(); |
|
|
|
final Configuration config = Configuration.getInstance(); |
|
|
|
CountDownTimer timer = new CountDownTimer(config.getReTryInterval(), 1000) { |
|
|
|
CountDownTimer timer = new CountDownTimer(config.getReTryInterval(), 1000) { |
|
|
|
@Override public void onTick(long millisUntilFinished) { |
|
|
|
@Override public void onTick(long millisUntilFinished) { |
|
|
@ -202,6 +201,7 @@ public class DownloadSchedulers implements IDownloadSchedulers { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override public void onFinish() { |
|
|
|
@Override public void onFinish() { |
|
|
|
|
|
|
|
DownloadEntity entity = task.getDownloadEntity(); |
|
|
|
if (entity.getFailNum() <= config.getReTryNum()) { |
|
|
|
if (entity.getFailNum() <= config.getReTryNum()) { |
|
|
|
Task task = mQueue.getTask(entity); |
|
|
|
Task task = mQueue.getTask(entity); |
|
|
|
mQueue.reTryStart(task); |
|
|
|
mQueue.reTryStart(task); |
|
|
@ -211,6 +211,7 @@ public class DownloadSchedulers implements IDownloadSchedulers { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
mQueue.removeTask(entity); |
|
|
|
startNextTask(entity); |
|
|
|
startNextTask(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|