修复一个数据升级导致的taskType列不存在问题,https://github.com/AriaLyy/Aria/issues/586
This commit is contained in:
laoyuyu
2020-01-09 20:44:01 +08:00
parent 7c4012c021
commit 90e55a0cee
25 changed files with 194 additions and 91 deletions

View File

@@ -89,6 +89,9 @@ public final class HttpDGInfoTask implements IInfoTask {
} catch (InterruptedException e) {
e.printStackTrace();
}
if (!mPool.isShutdown()){
mPool.shutdown();
}
} else {
for (DTaskWrapper wrapper : wrapper.getSubTaskWrapper()) {
cloneHeader(wrapper);

View File

@@ -66,7 +66,7 @@ final class HttpDGLoader extends AbsGroupLoader {
}
@Override public void onFail(AbsEntity entity, BaseException e, boolean needRetry) {
getListener().onFail(needRetry, e);
fail(e, needRetry);
}
});
}

View File

@@ -24,7 +24,6 @@ import com.arialyy.aria.http.BaseHttpThreadTaskAdapter;
import com.arialyy.aria.http.ConnectionHelp;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.BufferedRandomAccessFile;
import com.arialyy.aria.util.FileUtil;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -112,7 +111,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
new BufferedRandomAccessFile(getThreadConfig().tempFile, "rwd",
getTaskConfig().getBuffSize());
//设置每条线程写入文件的位置
if (getThreadRecord().startLocation > 0){
if (getThreadRecord().startLocation > 0) {
file.seek(getThreadRecord().startLocation);
}
readNormal(is, file);
@@ -199,6 +198,7 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
fos = new FileOutputStream(getThreadConfig().tempFile, true);
foc = fos.getChannel();
fic = Channels.newChannel(is);
ByteBuffer bf = ByteBuffer.allocate(getTaskConfig().getBuffSize());
//如果要通过 Future 的 cancel 方法取消正在运行的任务,那么该任务必定是可以 对线程中断做出响应 的任务。