修复now模式下的一些问题 https://github.com/AriaLyy/Aria/issues/620
修复wait模式下,resume(true)无效问题
This commit is contained in:
@@ -29,7 +29,7 @@ import com.arialyy.aria.util.NetUtils;
|
||||
*/
|
||||
final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
|
||||
private boolean newStart = false;
|
||||
private boolean nowStart = false;
|
||||
|
||||
StartCmd(T entity, int taskType) {
|
||||
super(entity, taskType);
|
||||
@@ -38,10 +38,10 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
/**
|
||||
* 立即执行任务
|
||||
*
|
||||
* @param newStart true 立即执行任务,无论执行队列是否满了
|
||||
* @param nowStart true 立即执行任务,无论执行队列是否满了
|
||||
*/
|
||||
public void setNewStart(boolean newStart) {
|
||||
this.newStart = newStart;
|
||||
public void setNowStart(boolean nowStart) {
|
||||
this.nowStart = nowStart;
|
||||
}
|
||||
|
||||
@Override public void executeCmd() {
|
||||
@@ -82,7 +82,7 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
startTask();
|
||||
}
|
||||
} else {
|
||||
if (newStart) {
|
||||
if (nowStart) {
|
||||
startTask();
|
||||
} else {
|
||||
sendWaitState(task);
|
||||
@@ -92,7 +92,19 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> {
|
||||
} else {
|
||||
//任务没执行并且执行队列中没有该任务,才认为任务没有运行中
|
||||
if (!mQueue.taskIsRunning(task.getKey())) {
|
||||
resumeTask();
|
||||
if (mod.equals(QueueMod.NOW.getTag())) {
|
||||
resumeTask();
|
||||
} else {
|
||||
if (mQueue.getCurrentExePoolNum() < maxTaskNum) {
|
||||
resumeTask();
|
||||
} else {
|
||||
if (nowStart) {
|
||||
resumeTask();
|
||||
} else {
|
||||
sendWaitState(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ALog.w(TAG, String.format("任务【%s】已经在运行", task.getTaskName()));
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class NormalController extends FeatureController implements INormal
|
||||
StartCmd cmd =
|
||||
(StartCmd) CmdHelper.createNormalCmd(getTaskWrapper(), NormalCmdFactory.TASK_START,
|
||||
checkTaskType());
|
||||
cmd.setNewStart(newStart);
|
||||
cmd.setNowStart(newStart);
|
||||
EventMsgUtil.getDefault()
|
||||
.post(cmd);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,10 @@ public abstract class AbsTaskQueue<TASK extends AbsTask, TASK_WRAPPER extends Ab
|
||||
ALog.w(TAG, "resume task fail, task is null");
|
||||
return;
|
||||
}
|
||||
if (mExecutePool.taskExits(task.getKey())) {
|
||||
ALog.w(TAG, String.format("task【%s】running", task.getKey()));
|
||||
return;
|
||||
}
|
||||
if (mExecutePool.size() >= getMaxTaskNum()) {
|
||||
task.getTaskWrapper().getEntity().setState(IEntity.STATE_WAIT);
|
||||
mCachePool.putTaskToFirst(task);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
## 开发日志
|
||||
+ v_3.8.7
|
||||
- 修复组合任务单个子任务失败后,重新恢复组合任务,组合任务状态变为完成的问题
|
||||
|
||||
- 修复40x错误,会继续重试并且无法重试成功的问题 https://github.com/AriaLyy/Aria/issues/619
|
||||
- 修复wait模式下,resume(true)无效问题
|
||||
- 修复now模式下的一些问题 https://github.com/AriaLyy/Aria/issues/620
|
||||
+ v_3.8.6 (2020/2/17)
|
||||
- fix bug https://github.com/AriaLyy/Aria/issues/608
|
||||
- fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035
|
||||
|
||||
@@ -37,6 +37,9 @@ final class FtpULoader extends NormalLoader<UTaskWrapper> {
|
||||
|
||||
@Override
|
||||
protected void startThreadTask() {
|
||||
if (isBreak()) {
|
||||
return;
|
||||
}
|
||||
// 检查记录
|
||||
((FtpURecordHandler) mRecordHandler).setFtpFile(ftpFile);
|
||||
if (mRecordHandler.checkTaskCompleted()) {
|
||||
|
||||
@@ -36,13 +36,6 @@ public final class HttpRecordHandler extends RecordHandler {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
@Override public void onPre() {
|
||||
super.onPre();
|
||||
//if (getWrapper().getRequestType() == ITaskWrapper.U_HTTP) {
|
||||
// RecordUtil.delTaskRecord(getEntity().getFilePath(), IRecordHandler.TYPE_UPLOAD);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override public void handlerTaskRecord(TaskRecord record) {
|
||||
RecordHelper helper = new RecordHelper(getWrapper(), record);
|
||||
if (getWrapper().isSupportBP() && record.threadNum > 1) {
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.Set;
|
||||
* Created by lyy on 2017/1/18. 下载线程
|
||||
*/
|
||||
final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
|
||||
private final String TAG = "HttpThreadTask";
|
||||
private final String TAG = "HttpDThreadTaskAdapter";
|
||||
private DTaskWrapper mTaskWrapper;
|
||||
|
||||
HttpDThreadTaskAdapter(SubThreadConfig config) {
|
||||
|
||||
@@ -130,13 +130,17 @@ public class RecordHelper {
|
||||
/*
|
||||
* 检查记录文件
|
||||
*/
|
||||
if (blockFileLen == threadRect) {
|
||||
if (blockFileLen == threadRect && blockFileLen != 0) {
|
||||
ALog.i(TAG, String.format("分块【%s】已完成,更新记录", temp.getPath()));
|
||||
tr.startLocation = blockFileLen;
|
||||
tr.isComplete = true;
|
||||
} else if (tr.startLocation != realLocation) { // 处理记录小于分块文件长度的情况
|
||||
ALog.i(TAG, String.format("修正分块【%s】的进度记录为:%s", temp.getPath(), realLocation));
|
||||
tr.startLocation = realLocation;
|
||||
}else {
|
||||
ALog.i(TAG, String.format("修正分块【%s】的进度记录为:%s", temp.getPath(), realLocation));
|
||||
tr.startLocation = realLocation;
|
||||
tr.isComplete = false;
|
||||
}
|
||||
} else {
|
||||
ALog.i(TAG, String.format("分块【%s】已完成", temp.getPath()));
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.arialyy.aria.core.manager.ThreadTaskManager;
|
||||
import com.arialyy.aria.core.task.IThreadTask;
|
||||
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
|
||||
import com.arialyy.aria.exception.AriaException;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
import com.arialyy.aria.util.FileUtil;
|
||||
import java.io.File;
|
||||
|
||||
@@ -99,6 +100,9 @@ public class NormalLoader<T extends AbsTaskWrapper> extends AbsNormalLoader<T> {
|
||||
}
|
||||
|
||||
protected void startThreadTask() {
|
||||
if (isBreak()){
|
||||
return;
|
||||
}
|
||||
|
||||
if (getListener() instanceof IDLoadListener) {
|
||||
((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize());
|
||||
|
||||
@@ -93,6 +93,10 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
|
||||
}
|
||||
|
||||
private void handlerTask() {
|
||||
if (isBreak()){
|
||||
return;
|
||||
}
|
||||
|
||||
record = recordHandler.getRecord(wrapper.getEntity().getFileSize());
|
||||
if (record.threadRecords != null
|
||||
&& !TextUtils.isEmpty(record.filePath)
|
||||
|
||||
@@ -87,6 +87,9 @@ final class SFtpDLoader extends AbsNormalLoader<DTaskWrapper> {
|
||||
}
|
||||
|
||||
private void startThreadTask() {
|
||||
if (isBreak()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getListener() instanceof IDLoadListener) {
|
||||
((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize());
|
||||
|
||||
@@ -86,6 +86,9 @@ final class SFtpULoader extends AbsNormalLoader<UTaskWrapper> {
|
||||
}
|
||||
|
||||
private void startThreadTask(SftpATTRS attrs) {
|
||||
if (isBreak()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getListener() instanceof IDLoadListener) {
|
||||
((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize());
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<download>
|
||||
|
||||
<!--设置任务最大下载速度,0表示不限速,单位为:kb-->
|
||||
<maxSpeed value="0"/>
|
||||
<maxSpeed value="200"/>
|
||||
|
||||
<!--
|
||||
多线程下载是否使用块下载模式,{@code true}使用,{@code false}不使用
|
||||
@@ -44,7 +44,7 @@
|
||||
<threadNum value="3"/>
|
||||
|
||||
<!--设置下载队列最大任务数, 默认为2-->
|
||||
<maxTaskNum value="1"/>
|
||||
<maxTaskNum value="2"/>
|
||||
|
||||
<!--设置下载失败,重试次数,默认为10-->
|
||||
<reTryNum value="5"/>
|
||||
@@ -68,7 +68,7 @@
|
||||
<convertSpeed value="true"/>
|
||||
|
||||
<!--执行队列类型,见com.arialyy.aria.core.QueueMod,默认类型为wait-->
|
||||
<queueMod value="wait"/>
|
||||
<queueMod value="now"/>
|
||||
|
||||
<!--进度更新更新间隔,默认1000毫秒-->
|
||||
<updateInterval value="1000"/>
|
||||
|
||||
@@ -44,8 +44,8 @@ task clean(type: Delete) {
|
||||
}
|
||||
|
||||
ext {
|
||||
versionCode = 386
|
||||
versionName = '3.8.6'
|
||||
versionCode = 387
|
||||
versionName = '3.8.7-beta-1'
|
||||
userOrg = 'arialyy'
|
||||
groupId = 'com.arialyy.aria'
|
||||
publishVersion = versionName
|
||||
|
||||
Reference in New Issue
Block a user