From c2cfb5a36c167e2f7778c32723903c9c26021312 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Thu, 23 Aug 2018 21:38:45 +0800 Subject: [PATCH] fix bug --- .../com/arialyy/aria/core/command/AbsCmd.java | 1 - .../aria/core/command/AbsCmdFactory.java | 3 +- .../aria/core/command/group/AbsGroupCmd.java | 8 +--- .../core/command/group/GroupCancelCmd.java | 7 +--- .../core/command/group/GroupCmdFactory.java | 6 +-- .../core/command/group/GroupStartCmd.java | 7 +--- .../aria/core/command/group/GroupStopCmd.java | 7 +--- .../core/command/normal/AbsNormalCmd.java | 10 ++--- .../aria/core/command/normal/AddCmd.java | 4 +- .../core/command/normal/CancelAllCmd.java | 7 +--- .../aria/core/command/normal/CancelCmd.java | 8 +--- .../command/normal/HighestPriorityCmd.java | 10 +---- .../core/command/normal/NormalCmdFactory.java | 19 +++++----- .../core/command/normal/ResumeAllCmd.java | 7 +--- .../aria/core/command/normal/StartCmd.java | 9 +---- .../aria/core/command/normal/StopAllCmd.java | 7 +--- .../aria/core/command/normal/StopCmd.java | 10 ++--- .../com/arialyy/aria/core/common/AEvent.java | 37 +++++++++++++++++++ .../arialyy/aria/core/common/AbsFileer.java | 20 ++++++---- .../aria/core/common/AbsThreadTask.java | 27 +++++++++++++- .../aria/core/download/AbsDownloadTarget.java | 6 +-- .../aria/core/download/DownloadGroupTask.java | 8 +--- .../aria/core/download/DownloadReceiver.java | 6 +-- .../aria/core/download/DownloadTask.java | 8 +--- .../download/downloader/AbsGroupUtil.java | 7 +++- .../download/downloader/FtpThreadTask.java | 17 +++++---- .../download/downloader/HttpThreadTask.java | 14 ++++--- .../com/arialyy/aria/core/inf/AbsTarget.java | 25 ++++++------- .../com/arialyy/aria/core/inf/AbsTask.java | 14 +------ .../java/com/arialyy/aria/core/inf/ITask.java | 1 - .../aria/core/manager/ThreadTaskManager.java | 2 + .../arialyy/aria/core/queue/AbsTaskQueue.java | 5 --- .../core/queue/DownloadGroupTaskQueue.java | 19 ++++------ .../aria/core/queue/DownloadTaskQueue.java | 19 ++++------ .../arialyy/aria/core/queue/ITaskQueue.java | 3 +- .../arialyy/aria/core/queue/TaskFactory.java | 25 ++++++------- .../aria/core/queue/UploadTaskQueue.java | 19 ++++------ .../aria/core/upload/BaseNormalTarget.java | 2 +- .../aria/core/upload/FtpUploadTarget.java | 2 +- .../aria/core/upload/UploadReceiver.java | 4 +- .../core/upload/uploader/FtpThreadTask.java | 11 +++--- .../core/upload/uploader/HttpThreadTask.java | 9 +++-- .../com/arialyy/aria/util/CommonUtil.java | 4 +- README.md | 4 +- .../arialyy/aria/core/upload/UploadTask.java | 9 +---- build.gradle | 2 +- 46 files changed, 217 insertions(+), 242 deletions(-) create mode 100644 Aria/src/main/java/com/arialyy/aria/core/common/AEvent.java diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmd.java index 34c80642..5e0f9ec3 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmd.java @@ -26,7 +26,6 @@ public abstract class AbsCmd implements ICmd { protected ITaskQueue mQueue; protected T mTaskEntity; protected String TAG; - protected String mTargetName; /** * 是否是下载任务的命令 diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmdFactory.java b/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmdFactory.java index d0def907..4783fd91 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmdFactory.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/AbsCmdFactory.java @@ -24,10 +24,9 @@ import com.arialyy.aria.core.inf.AbsTaskEntity; public abstract class AbsCmdFactory { /** - * @param target 创建任务的对象 * @param entity 下载实体 * @param taskType {@link ICmd#TASK_TYPE_DOWNLOAD}、{@link ICmd#TASK_TYPE_DOWNLOAD_GROUP}、{@link * ICmd#TASK_TYPE_UPLOAD} */ - public abstract CMD createCmd(String target, TASK_ENTITY entity, int type, int taskType); + public abstract CMD createCmd(TASK_ENTITY entity, int type, int taskType); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/group/AbsGroupCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/group/AbsGroupCmd.java index 0246b207..6f0cd071 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/group/AbsGroupCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/group/AbsGroupCmd.java @@ -36,11 +36,7 @@ public abstract class AbsGroupCmd extends AbsCmd extends AbsCmd extends AbsGroupCmd { - /** - * @param targetName 创建任务的对象名 - */ - GroupCancelCmd(String targetName, T entity) { - super(targetName, entity); + GroupCancelCmd(T entity) { + super(entity); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupCmdFactory.java b/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupCmdFactory.java index 8af60348..e96a9437 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupCmdFactory.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupCmdFactory.java @@ -62,13 +62,13 @@ public class GroupCmdFactory { AbsGroupCmd cmd = null; switch (type) { case SUB_TASK_START: - cmd = new GroupStartCmd<>(target, entity); + cmd = new GroupStartCmd<>(entity); break; case SUB_TASK_STOP: - cmd = new GroupStopCmd<>(target, entity); + cmd = new GroupStopCmd<>(entity); break; case SUB_TASK_CANCEL: - cmd = new GroupCancelCmd<>(target, entity); + cmd = new GroupCancelCmd<>(entity); } if (cmd != null) { cmd.childUrl = childUrl; diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStartCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStartCmd.java index 747e794c..be661ebc 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStartCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStartCmd.java @@ -22,11 +22,8 @@ import com.arialyy.aria.core.inf.AbsGroupTaskEntity; * 任务组开始命令,该命令负责处理任务组子任务的开始\恢复等工作 */ class GroupStartCmd extends AbsGroupCmd { - /** - * @param targetName 创建任务的对象名 - */ - GroupStartCmd(String targetName, T entity) { - super(targetName, entity); + GroupStartCmd( T entity) { + super( entity); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStopCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStopCmd.java index 483a7608..009a8e90 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStopCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/group/GroupStopCmd.java @@ -22,11 +22,8 @@ import com.arialyy.aria.core.inf.AbsGroupTaskEntity; * 停止任务组的命令 */ class GroupStopCmd extends AbsGroupCmd { - /** - * @param targetName 创建任务的对象名 - */ - GroupStopCmd(String targetName, T entity) { - super(targetName, entity); + GroupStopCmd(T entity) { + super(entity); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java index 7e6a996a..3ef585b1 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AbsNormalCmd.java @@ -46,13 +46,11 @@ public abstract class AbsNormalCmd extends AbsCmd { int taskType; /** - * @param targetName 产生任务的对象名 * @param taskType 下载任务类型{@link ICmd#TASK_TYPE_DOWNLOAD}、{@link ICmd#TASK_TYPE_DOWNLOAD_GROUP}、{@link * ICmd#TASK_TYPE_UPLOAD} */ - AbsNormalCmd(String targetName, T entity, int taskType) { + AbsNormalCmd(T entity, int taskType) { this.taskType = taskType; - mTargetName = targetName; mTaskEntity = entity; TAG = CommonUtil.getClassName(this); if (taskType == ICmd.TASK_TYPE_DOWNLOAD) { @@ -126,7 +124,7 @@ public abstract class AbsNormalCmd extends AbsCmd { */ void removeTask(AbsTaskEntity taskEntity) { AbsTask tempTask = getTask(taskEntity.getEntity()); - if (tempTask == null){ + if (tempTask == null) { tempTask = createTask(taskEntity); } mQueue.cancelTask(tempTask); @@ -181,7 +179,7 @@ public abstract class AbsNormalCmd extends AbsCmd { * @return 创建的任务 */ AbsTask createTask() { - tempTask = mQueue.createTask(mTargetName, mTaskEntity); + tempTask = mQueue.createTask(mTaskEntity); return tempTask; } @@ -193,6 +191,6 @@ public abstract class AbsNormalCmd extends AbsCmd { */ AbsTask createTask(AbsTaskEntity taskEntity) { TEManager.getInstance().addTEntity(taskEntity); - return mQueue.createTask(mTargetName, taskEntity); + return mQueue.createTask(taskEntity); } } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java index 554e9c74..a34d385f 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/AddCmd.java @@ -27,8 +27,8 @@ import com.arialyy.aria.util.ALog; */ class AddCmd extends AbsNormalCmd { - AddCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + AddCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java index 9c4181a5..f28c6130 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelAllCmd.java @@ -41,11 +41,8 @@ public class CancelAllCmd extends AbsNormalCmd { */ public boolean removeFile = false; - /** - * @param targetName 产生任务的对象名 - */ - CancelAllCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + CancelAllCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java index 57ab73d1..f0a80cdf 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/CancelCmd.java @@ -16,7 +16,6 @@ package com.arialyy.aria.core.command.normal; -import android.text.TextUtils; import com.arialyy.aria.core.inf.AbsTask; import com.arialyy.aria.core.inf.AbsTaskEntity; @@ -31,8 +30,8 @@ public class CancelCmd extends AbsNormalCmd { */ public boolean removeFile = false; - CancelCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + CancelCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { @@ -43,9 +42,6 @@ public class CancelCmd extends AbsNormalCmd { } if (task != null) { mTaskEntity.setRemoveFile(removeFile); - if (!TextUtils.isEmpty(mTargetName)) { - task.setTargetName(mTargetName); - } removeTask(); } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java index ac3570d1..a033a145 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/HighestPriorityCmd.java @@ -36,11 +36,8 @@ import com.arialyy.aria.util.NetUtils; * 目前只只支持单下载任务的最高优先级任务 */ final class HighestPriorityCmd extends AbsNormalCmd { - /** - * @param targetName 产生任务的对象名 - */ - HighestPriorityCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + HighestPriorityCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { @@ -54,9 +51,6 @@ final class HighestPriorityCmd extends AbsNormalCmd task = (DownloadTask) createTask(); } if (task != null) { - if (!TextUtils.isEmpty(mTargetName)) { - task.setTargetName(mTargetName); - } ((DownloadTaskQueue) mQueue).setTaskHighestPriority(task); } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/NormalCmdFactory.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/NormalCmdFactory.java index 005e31b0..837d01a3 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/NormalCmdFactory.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/NormalCmdFactory.java @@ -78,32 +78,31 @@ public class NormalCmdFactory extends AbsCmdFactory } /** - * @param target 创建任务的对象 * @param entity 下载实体 * @param type 命令类型{@link #TASK_CREATE}、{@link #TASK_START}、{@link #TASK_CANCEL}、{@link * #TASK_STOP}、{@link #TASK_HIGHEST_PRIORITY}、{@link #TASK_STOP_ALL}、{@link #TASK_RESUME_ALL} * @param taskType {@link ICmd#TASK_TYPE_DOWNLOAD}、{@link ICmd#TASK_TYPE_DOWNLOAD_GROUP}、{@link * ICmd#TASK_TYPE_UPLOAD} */ - public AbsNormalCmd createCmd(String target, AbsTaskEntity entity, int type, int taskType) { + public AbsNormalCmd createCmd(AbsTaskEntity entity, int type, int taskType) { switch (type) { case TASK_CREATE: - return new AddCmd<>(target, entity, taskType); + return new AddCmd<>(entity, taskType); case TASK_RESUME: case TASK_START: - return new StartCmd<>(target, entity, taskType); + return new StartCmd<>(entity, taskType); case TASK_CANCEL: - return new CancelCmd<>(target, entity, taskType); + return new CancelCmd<>(entity, taskType); case TASK_STOP: - return new StopCmd<>(target, entity, taskType); + return new StopCmd<>(entity, taskType); case TASK_HIGHEST_PRIORITY: - return new HighestPriorityCmd<>(target, entity, taskType); + return new HighestPriorityCmd<>(entity, taskType); case TASK_STOP_ALL: - return new StopAllCmd<>(target, entity, taskType); + return new StopAllCmd<>(entity, taskType); case TASK_RESUME_ALL: - return new ResumeAllCmd<>(target, entity, taskType); + return new ResumeAllCmd<>(entity, taskType); case TASK_CANCEL_ALL: - return new CancelAllCmd<>(target, entity, taskType); + return new CancelAllCmd<>(entity, taskType); default: return null; } diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java index 76a80536..2d183fd0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/ResumeAllCmd.java @@ -32,11 +32,8 @@ import java.util.List; final class ResumeAllCmd extends AbsNormalCmd { private List mWaitList = new ArrayList<>(); - /** - * @param targetName 产生任务的对象名 - */ - ResumeAllCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + ResumeAllCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java index ece35307..511c8d10 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StartCmd.java @@ -16,8 +16,6 @@ package com.arialyy.aria.core.command.normal; -import android.text.TextUtils; -import android.util.Log; import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.common.QueueMod; import com.arialyy.aria.core.download.DownloadGroupTaskEntity; @@ -46,8 +44,8 @@ import java.util.List; */ class StartCmd extends AbsNormalCmd { - StartCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + StartCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { @@ -68,9 +66,6 @@ class StartCmd extends AbsNormalCmd { AbsTask task = getTask(); if (task == null) { task = createTask(); - if (!TextUtils.isEmpty(mTargetName)) { - task.setTargetName(mTargetName); - } // 任务不存在时,根据配置不同,对任务执行操作 if (mod.equals(QueueMod.NOW.getTag())) { startTask(); diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java index 7f55e573..ff15dc92 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopAllCmd.java @@ -7,11 +7,8 @@ import com.arialyy.aria.core.inf.AbsTaskEntity; * 停止所有任务的命令,并清空所有等待队列 */ final class StopAllCmd extends AbsNormalCmd { - /** - * @param targetName 产生任务的对象名 - */ - StopAllCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + StopAllCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java index 15a9479b..396cd389 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/normal/StopCmd.java @@ -16,10 +16,9 @@ package com.arialyy.aria.core.command.normal; -import android.text.TextUtils; import com.arialyy.aria.core.inf.AbsTask; -import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.core.inf.AbsTaskEntity; +import com.arialyy.aria.core.inf.IEntity; import com.arialyy.aria.util.ALog; /** @@ -28,8 +27,8 @@ import com.arialyy.aria.util.ALog; */ class StopCmd extends AbsNormalCmd { - StopCmd(String targetName, T entity, int taskType) { - super(targetName, entity, taskType); + StopCmd(T entity, int taskType) { + super(entity, taskType); } @Override public void executeCmd() { @@ -42,9 +41,6 @@ class StopCmd extends AbsNormalCmd { ALog.w(TAG, "停止命令执行失败,【调度器中没有该任务】"); } } else { - if (!TextUtils.isEmpty(mTargetName)) { - task.setTargetName(mTargetName); - } stopTask(); } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AEvent.java b/Aria/src/main/java/com/arialyy/aria/core/common/AEvent.java new file mode 100644 index 00000000..f5852b92 --- /dev/null +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.arialyy.aria.core.common; + +/** + * Aria事件总线 + */ +public class AEvent { + private static final Object LOCK = new Object(); + private static volatile AEvent INSTANCE = null; + + private AEvent() { + + } + + public static AEvent getInstance() { + if (INSTANCE == null) { + synchronized (LOCK) { + INSTANCE = new AEvent(); + } + } + return INSTANCE; + } +} diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java index 8c2a5237..aa8dc8cd 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java @@ -42,7 +42,8 @@ import java.util.TimerTask; * Created by AriaL on 2017/7/1. * 任务处理器 */ -public abstract class AbsFileer> { +public abstract class AbsFileer> + implements Runnable { private static final String STATE = "_state_"; private static final String RECORD = "_record_"; /** @@ -139,7 +140,7 @@ public abstract class AbsFileer> - implements Callable { + implements Callable { /** * 线程重试次数 */ @@ -60,13 +60,14 @@ public abstract class AbsThreadTask { public static class Builder { DownloadGroupTaskEntity taskEntity; Handler outHandler; - String targetName; - public Builder(String targetName, DownloadGroupTaskEntity taskEntity) { + public Builder(DownloadGroupTaskEntity taskEntity) { CheckUtil.checkTaskEntity(taskEntity); - this.targetName = targetName; this.taskEntity = taskEntity; } @@ -117,9 +115,7 @@ public class DownloadGroupTask extends AbsGroupTask { } public DownloadGroupTask build() { - DownloadGroupTask task = new DownloadGroupTask(taskEntity, outHandler); - task.setTargetName(targetName); - return task; + return new DownloadGroupTask(taskEntity, outHandler); } } } diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java index b3c84d77..341d4d52 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadReceiver.java @@ -370,7 +370,7 @@ public class DownloadReceiver extends AbsReceiver { public void stopAllTask() { AriaManager.getInstance(AriaManager.APP) .setCmd(NormalCmdFactory.getInstance() - .createCmd(targetName, new DownloadTaskEntity(), NormalCmdFactory.TASK_STOP_ALL, + .createCmd(new DownloadTaskEntity(), NormalCmdFactory.TASK_STOP_ALL, ICmd.TASK_TYPE_DOWNLOAD)) .exe(); } @@ -383,7 +383,7 @@ public class DownloadReceiver extends AbsReceiver { public void resumeAllTask() { AriaManager.getInstance(AriaManager.APP) .setCmd(NormalCmdFactory.getInstance() - .createCmd(targetName, new DownloadTaskEntity(), NormalCmdFactory.TASK_RESUME_ALL, + .createCmd(new DownloadTaskEntity(), NormalCmdFactory.TASK_RESUME_ALL, ICmd.TASK_TYPE_DOWNLOAD)) .exe(); } @@ -397,7 +397,7 @@ public class DownloadReceiver extends AbsReceiver { public void removeAllTask(boolean removeFile) { final AriaManager ariaManager = AriaManager.getInstance(AriaManager.APP); CancelAllCmd cancelCmd = - (CancelAllCmd) CommonUtil.createNormalCmd(targetName, new DownloadTaskEntity(), + (CancelAllCmd) CommonUtil.createNormalCmd(new DownloadTaskEntity(), NormalCmdFactory.TASK_CANCEL_ALL, ICmd.TASK_TYPE_DOWNLOAD); cancelCmd.removeFile = removeFile; ariaManager.setCmd(cancelCmd).exe(); diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java index f86f9721..411bb131 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/DownloadTask.java @@ -143,10 +143,8 @@ public class DownloadTask extends AbsNormalTask { public static class Builder { DownloadTaskEntity taskEntity; Handler outHandler; - String targetName; - public Builder(String targetName, DownloadTaskEntity taskEntity) { - this.targetName = targetName; + public Builder(DownloadTaskEntity taskEntity) { this.taskEntity = taskEntity; } @@ -166,9 +164,7 @@ public class DownloadTask extends AbsNormalTask { } public DownloadTask build() { - DownloadTask task = new DownloadTask(taskEntity, outHandler); - task.setTargetName(targetName); - return task; + return new DownloadTask(taskEntity, outHandler); } } } \ No newline at end of file diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java index 36db9187..a07e6fe3 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/AbsGroupUtil.java @@ -31,13 +31,12 @@ import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; /** * Created by AriaL on 2017/6/30. * 任务组核心逻辑 */ -public abstract class AbsGroupUtil implements IUtil { +public abstract class AbsGroupUtil implements IUtil, Runnable { private static final Object LOCK = new Object(); private final String TAG = "AbsGroupUtil"; /** @@ -286,6 +285,10 @@ public abstract class AbsGroupUtil implements IUtil { } @Override public void start() { + new Thread(this).start(); + } + + @Override public void run() { if (isStop || isCancel) { closeTimer(); return; diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/FtpThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/FtpThreadTask.java index bbaa67ed..dcebff93 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/FtpThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/FtpThreadTask.java @@ -53,10 +53,11 @@ class FtpThreadTask extends AbsFtpThreadTask isBlock = STATE.TASK_RECORD.isBlock; } - @Override public DownloadTaskEntity call() throws Exception { + @Override public FtpThreadTask call() throws Exception { + super.call(); if (mConfig.THREAD_RECORD.isComplete) { handleComplete(); - return mTaskEntity; + return this; } mChildCurrentLocation = mConfig.START_LOCATION; FTPClient client = null; @@ -69,7 +70,7 @@ class FtpThreadTask extends AbsFtpThreadTask client = createClient(); if (client == null) { fail(mChildCurrentLocation, "ftp client 创建失败", null); - return mTaskEntity; + return this; } if (mConfig.START_LOCATION > 0) { client.setRestartOffset(mConfig.START_LOCATION); @@ -81,7 +82,7 @@ class FtpThreadTask extends AbsFtpThreadTask String.format("获取文件信息错误,错误码为:%s,msg:%s", reply, client.getReplyString()), null); client.disconnect(); - return mTaskEntity; + return this; } String remotePath = new String(mTaskEntity.getUrlEntity().remotePath.getBytes(charSet), SERVER_CHARSET); @@ -93,7 +94,7 @@ class FtpThreadTask extends AbsFtpThreadTask String.format("获取流失败,错误码为:%s,msg:%s", reply, client.getReplyString()), null); client.disconnect(); - return mTaskEntity; + return this; } if (isOpenDynamicFile) { @@ -118,7 +119,7 @@ class FtpThreadTask extends AbsFtpThreadTask e.printStackTrace(); } } - return mTaskEntity; + return this; } /** @@ -165,7 +166,7 @@ class FtpThreadTask extends AbsFtpThreadTask foc = fos.getChannel(); fic = Channels.newChannel(is); ByteBuffer bf = ByteBuffer.allocate(mBufSize); - while (!Thread.currentThread().isInterrupted() && (len = fic.read(bf)) != -1) { + while (isLive() && (len = fic.read(bf)) != -1) { if (isBreak()) { break; } @@ -216,7 +217,7 @@ class FtpThreadTask extends AbsFtpThreadTask file.seek(mConfig.START_LOCATION); byte[] buffer = new byte[mBufSize]; int len; - while (!Thread.currentThread().isInterrupted() && (len = is.read(buffer)) != -1) { + while (isLive() && (len = is.read(buffer)) != -1) { if (isBreak()) { break; } diff --git a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java index acf9192b..20575ff0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java @@ -56,10 +56,11 @@ final class HttpThreadTask extends AbsThreadTask cmds = new ArrayList<>(); int taskType = checkTaskType(); cmds.add( - CommonUtil.createNormalCmd(mTargetName, mTaskEntity, NormalCmdFactory.TASK_STOP, - taskType)); - cmds.add(CommonUtil.createNormalCmd(mTargetName, mTaskEntity, NormalCmdFactory.TASK_START, - taskType)); + CommonUtil.createNormalCmd(mTaskEntity, NormalCmdFactory.TASK_STOP, taskType)); + cmds.add(CommonUtil.createNormalCmd(mTaskEntity, NormalCmdFactory.TASK_START, taskType)); AriaManager.getInstance(AriaManager.APP).setCmds(cmds).exe(); } } @@ -290,8 +288,9 @@ public abstract class AbsTarget implements ITas protected TASK_ENTITY mTaskEntity; protected Handler mOutHandler; - /** - * 用于生成该任务对象的hash码 - */ - private String mTargetName; protected Context mContext; - protected boolean isHeighestTask = false; + boolean isHeighestTask = false; private boolean isCancel = false, isStop = false; protected IUtil mUtil; @@ -212,14 +208,6 @@ public abstract class AbsTask implements ITas */ public abstract String getTaskName(); - public String getTargetName() { - return mTargetName; - } - - @Override public void setTargetName(String targetName) { - this.mTargetName = targetName; - } - public boolean isHighestPriorityTask() { return isHeighestTask; } diff --git a/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java b/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java index 6a5016a9..21685b0d 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/inf/ITask.java @@ -90,5 +90,4 @@ public interface ITask { */ String getConvertCurrentProgress(); - void setTargetName(String targetName); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/manager/ThreadTaskManager.java b/Aria/src/main/java/com/arialyy/aria/core/manager/ThreadTaskManager.java index 8229ae2f..5ae2d674 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/manager/ThreadTaskManager.java +++ b/Aria/src/main/java/com/arialyy/aria/core/manager/ThreadTaskManager.java @@ -87,6 +87,8 @@ public class ThreadTaskManager { if (future.isDone() || future.isCancelled()) { continue; } + AbsThreadTask task = (AbsThreadTask) future.get(); + task.setInterrupted(true); future.cancel(true); } } catch (Exception e) { diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java index 7bf73715..80cb9a77 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java @@ -187,7 +187,6 @@ abstract class AbsTaskQueue ITask createTask( - String targetName, TASK_ENTITY entity, SCHEDULER schedulers) { + TASK_ENTITY entity, SCHEDULER schedulers) { if (entity instanceof DownloadTaskEntity) { - return createDownloadTask(targetName, (DownloadTaskEntity) entity, schedulers); + return createDownloadTask((DownloadTaskEntity) entity, schedulers); } else if (entity instanceof UploadTaskEntity) { - return createUploadTask(targetName, (UploadTaskEntity) entity, schedulers); + return createUploadTask((UploadTaskEntity) entity, schedulers); } else if (entity instanceof DownloadGroupTaskEntity) { - return createDownloadGroupTask(targetName, (DownloadGroupTaskEntity) entity, schedulers); + return createDownloadGroupTask((DownloadGroupTaskEntity) entity, schedulers); } return null; } @@ -78,9 +78,9 @@ class TaskFactory { * @param entity 下载任务实体{@link DownloadGroupTask} * @param schedulers {@link ISchedulers} */ - private DownloadGroupTask createDownloadGroupTask(String targetName, - DownloadGroupTaskEntity entity, ISchedulers schedulers) { - DownloadGroupTask.Builder builder = new DownloadGroupTask.Builder(targetName, entity); + private DownloadGroupTask createDownloadGroupTask(DownloadGroupTaskEntity entity, + ISchedulers schedulers) { + DownloadGroupTask.Builder builder = new DownloadGroupTask.Builder(entity); builder.setOutHandler(schedulers); return builder.build(); } @@ -89,10 +89,8 @@ class TaskFactory { * @param entity 上传任务实体{@link UploadTaskEntity} * @param schedulers {@link ISchedulers} */ - private UploadTask createUploadTask(String targetName, UploadTaskEntity entity, - ISchedulers schedulers) { + private UploadTask createUploadTask(UploadTaskEntity entity, ISchedulers schedulers) { UploadTask.Builder builder = new UploadTask.Builder(); - builder.setTargetName(targetName); builder.setUploadTaskEntity(entity); builder.setOutHandler(schedulers); return builder.build(); @@ -102,9 +100,8 @@ class TaskFactory { * @param entity 下载任务实体{@link DownloadTaskEntity} * @param schedulers {@link ISchedulers} */ - private DownloadTask createDownloadTask(String targetName, DownloadTaskEntity entity, - ISchedulers schedulers) { - DownloadTask.Builder builder = new DownloadTask.Builder(targetName, entity); + private DownloadTask createDownloadTask(DownloadTaskEntity entity, ISchedulers schedulers) { + DownloadTask.Builder builder = new DownloadTask.Builder(entity); builder.setOutHandler(schedulers); return builder.build(); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/UploadTaskQueue.java b/Aria/src/main/java/com/arialyy/aria/core/queue/UploadTaskQueue.java index 570a0f0d..d235304d 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/UploadTaskQueue.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/UploadTaskQueue.java @@ -16,7 +16,6 @@ package com.arialyy.aria.core.queue; -import android.text.TextUtils; import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.queue.pool.BaseCachePool; import com.arialyy.aria.core.queue.pool.BaseExecutePool; @@ -62,19 +61,15 @@ public class UploadTaskQueue extends AbsTaskQueue return AriaManager.getInstance(AriaManager.APP).getUploadConfig().getMaxTaskNum(); } - @Override public UploadTask createTask(String targetName, UploadTaskEntity entity) { + @Override public UploadTask createTask(UploadTaskEntity entity) { UploadTask task = null; - if (!TextUtils.isEmpty(targetName)) { - if (mCachePool.getTask(entity.getEntity().getKey()) == null - && mExecutePool.getTask(entity.getEntity().getKey()) == null) { - task = (UploadTask) TaskFactory.getInstance() - .createTask(targetName, entity, UploadSchedulers.getInstance()); - mCachePool.putTask(task); - } else { - ALog.w(TAG, "任务已存在"); - } + if (mCachePool.getTask(entity.getEntity().getKey()) == null + && mExecutePool.getTask(entity.getEntity().getKey()) == null) { + task = (UploadTask) TaskFactory.getInstance() + .createTask(entity, UploadSchedulers.getInstance()); + mCachePool.putTask(task); } else { - ALog.e(TAG, "target name 为 null是!!"); + ALog.w(TAG, "任务已存在"); } return task; } diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/BaseNormalTarget.java b/Aria/src/main/java/com/arialyy/aria/core/upload/BaseNormalTarget.java index b56ad759..df175a3e 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/upload/BaseNormalTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/upload/BaseNormalTarget.java @@ -80,7 +80,7 @@ abstract class BaseNormalTarget mEntity.save(); mTaskEntity.save(); } - if (mTaskEntity.getUrlEntity().isFtps) { + if (mTaskEntity.getUrlEntity() != null && mTaskEntity.getUrlEntity().isFtps) { if (TextUtils.isEmpty(mTaskEntity.getUrlEntity().storePath)) { ALog.e(TAG, "证书路径为空"); return false; diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/FtpUploadTarget.java b/Aria/src/main/java/com/arialyy/aria/core/upload/FtpUploadTarget.java index fe60aae0..99f4978b 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/upload/FtpUploadTarget.java +++ b/Aria/src/main/java/com/arialyy/aria/core/upload/FtpUploadTarget.java @@ -54,7 +54,7 @@ public class FtpUploadTarget extends BaseNormalTarget public void add() { if (checkEntity()) { AriaManager.getInstance(AriaManager.APP) - .setCmd(CommonUtil.createNormalCmd(mTargetName, mTaskEntity, NormalCmdFactory.TASK_CREATE, + .setCmd(CommonUtil.createNormalCmd(mTaskEntity, NormalCmdFactory.TASK_CREATE, checkTaskType())) .exe(); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java b/Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java index 4f6dac4c..a2be1ed4 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java +++ b/Aria/src/main/java/com/arialyy/aria/core/upload/UploadReceiver.java @@ -123,7 +123,7 @@ public class UploadReceiver extends AbsReceiver { public void stopAllTask() { AriaManager.getInstance(AriaManager.APP) .setCmd(NormalCmdFactory.getInstance() - .createCmd(targetName, new UploadTaskEntity(), NormalCmdFactory.TASK_STOP_ALL, + .createCmd(new UploadTaskEntity(), NormalCmdFactory.TASK_STOP_ALL, ICmd.TASK_TYPE_UPLOAD)) .exe(); } @@ -137,7 +137,7 @@ public class UploadReceiver extends AbsReceiver { public void removeAllTask(boolean removeFile) { final AriaManager am = AriaManager.getInstance(AriaManager.APP); CancelAllCmd cancelCmd = - (CancelAllCmd) CommonUtil.createNormalCmd(targetName, new UploadTaskEntity(), + (CancelAllCmd) CommonUtil.createNormalCmd(new UploadTaskEntity(), NormalCmdFactory.TASK_CANCEL_ALL, ICmd.TASK_TYPE_UPLOAD); cancelCmd.removeFile = removeFile; am.setCmd(cancelCmd).exe(); diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/FtpThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/FtpThreadTask.java index c3a233f6..12c5f8ef 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/FtpThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/FtpThreadTask.java @@ -50,7 +50,8 @@ class FtpThreadTask extends AbsFtpThreadTask { return mAridManager.getUploadConfig().getMaxSpeed(); } - @Override public UploadTaskEntity call() throws Exception { + @Override public FtpThreadTask call() throws Exception { + super.call(); //当前子线程的下载位置 mChildCurrentLocation = mConfig.START_LOCATION; FTPClient client = null; @@ -61,7 +62,7 @@ class FtpThreadTask extends AbsFtpThreadTask { mConfig.THREAD_ID, mConfig.START_LOCATION, mConfig.END_LOCATION)); client = createClient(); if (client == null) { - return mTaskEntity; + return this; } initPath(); client.makeDirectory(dir); @@ -71,7 +72,7 @@ class FtpThreadTask extends AbsFtpThreadTask { if (!FTPReply.isPositivePreliminary(reply) && reply != FTPReply.FILE_ACTION_OK) { fail(mChildCurrentLocation, "上传失败,错误码为:" + reply + ",msg:" + client.getReplyString(), null); client.disconnect(); - return mTaskEntity; + return this; } file = new BufferedRandomAccessFile(mConfig.TEMP_FILE, "rwd", mBufSize); @@ -81,7 +82,7 @@ class FtpThreadTask extends AbsFtpThreadTask { } upload(client, file); if (isBreak()) { - return mTaskEntity; + return this; } ALog.i(TAG, String.format("任务【%s】线程__%s__上传完毕", mConfig.TEMP_FILE.getName(), mConfig.THREAD_ID)); @@ -112,7 +113,7 @@ class FtpThreadTask extends AbsFtpThreadTask { e.printStackTrace(); } } - return mTaskEntity; + return this; } private void initPath() throws UnsupportedEncodingException { diff --git a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java index 1978b9ed..17cd60a9 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java +++ b/Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java @@ -57,12 +57,13 @@ class HttpThreadTask extends AbsThreadTask { isNotNetRetry = mAridManager.getUploadConfig().isNotNetRetry(); } - @Override public UploadTaskEntity call() throws Exception { + @Override public HttpThreadTask call() throws Exception { + super.call(); File uploadFile = new File(mEntity.getFilePath()); if (!uploadFile.exists()) { ALog.e(TAG, String.format("【%s】,文件不存在。", mEntity.getFilePath())); fail(); - return mTaskEntity; + return this; } mListener.onPre(); URL url; @@ -103,7 +104,7 @@ class HttpThreadTask extends AbsThreadTask { e.printStackTrace(); fail(); } - return mTaskEntity; + return this; } private void fail() { @@ -200,7 +201,7 @@ class HttpThreadTask extends AbsThreadTask { if (status == HttpURLConnection.HTTP_OK) { BufferedReader reader = new BufferedReader(new InputStreamReader(mHttpConn.getInputStream())); String line; - while (!Thread.currentThread().isInterrupted() && (line = reader.readLine()) != null) { + while (isLive() && (line = reader.readLine()) != null) { response.append(line); } reader.close(); diff --git a/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java b/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java index 3d33e56c..9463a705 100644 --- a/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/util/CommonUtil.java @@ -689,9 +689,9 @@ public class CommonUtil { * @param taskType {@link ICmd#TASK_TYPE_DOWNLOAD}、{@link ICmd#TASK_TYPE_DOWNLOAD_GROUP}、{@link * ICmd#TASK_TYPE_UPLOAD} */ - public static AbsNormalCmd createNormalCmd(String target, T entity, + public static AbsNormalCmd createNormalCmd(T entity, int cmd, int taskType) { - return NormalCmdFactory.getInstance().createCmd(target, entity, cmd, taskType); + return NormalCmdFactory.getInstance().createCmd(entity, cmd, taskType); } /** diff --git a/README.md b/README.md index 22be89e0..b6c32dc9 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ Aria有以下特点: [![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion) [![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion) ```java -compile 'com.arialyy.aria:aria-core:3.4.12' -annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.12' +compile 'com.arialyy.aria:aria-core:3.4.15' +annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.15' ``` 如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:'`替换为 ``` diff --git a/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java b/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java index af00d525..0f87fafc 100644 --- a/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java +++ b/aria/src/main/java/com/arialyy/aria/core/upload/UploadTask.java @@ -83,7 +83,6 @@ public class UploadTask extends AbsNormalTask { public static class Builder { private Handler mOutHandler; private UploadTaskEntity mTaskEntity; - private String mTargetName; public void setOutHandler(ISchedulers outHandler) { try { @@ -98,18 +97,12 @@ public class UploadTask extends AbsNormalTask { mTaskEntity = taskEntity; } - public void setTargetName(String targetName) { - mTargetName = targetName; - } - public Builder() { } public UploadTask build() { - UploadTask task = new UploadTask(mTaskEntity, mOutHandler); - task.setTargetName(mTargetName); - return task; + return new UploadTask(mTaskEntity, mOutHandler); } } } diff --git a/build.gradle b/build.gradle index c401c2cf..33bd13cb 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.4.12' + publishVersion = '3.4.15' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'