|
|
@ -29,7 +29,7 @@ import com.arialyy.aria.util.NetUtils; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> { |
|
|
|
final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> { |
|
|
|
|
|
|
|
|
|
|
|
private boolean newStart = false; |
|
|
|
private boolean nowStart = false; |
|
|
|
|
|
|
|
|
|
|
|
StartCmd(T entity, int taskType) { |
|
|
|
StartCmd(T entity, int taskType) { |
|
|
|
super(entity, 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) { |
|
|
|
public void setNowStart(boolean nowStart) { |
|
|
|
this.newStart = newStart; |
|
|
|
this.nowStart = nowStart; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override public void executeCmd() { |
|
|
|
@Override public void executeCmd() { |
|
|
@ -82,7 +82,7 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> { |
|
|
|
startTask(); |
|
|
|
startTask(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (newStart) { |
|
|
|
if (nowStart) { |
|
|
|
startTask(); |
|
|
|
startTask(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
sendWaitState(task); |
|
|
|
sendWaitState(task); |
|
|
@ -92,7 +92,19 @@ final public class StartCmd<T extends AbsTaskWrapper> extends AbsNormalCmd<T> { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//任务没执行并且执行队列中没有该任务,才认为任务没有运行中
|
|
|
|
//任务没执行并且执行队列中没有该任务,才认为任务没有运行中
|
|
|
|
if (!mQueue.taskIsRunning(task.getKey())) { |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
ALog.w(TAG, String.format("任务【%s】已经在运行", task.getTaskName())); |
|
|
|
ALog.w(TAG, String.format("任务【%s】已经在运行", task.getTaskName())); |
|
|
|
} |
|
|
|
} |
|
|
|