3.6.6
This commit is contained in:
@@ -52,6 +52,32 @@ public class ThreadTaskManager {
|
||||
mExePool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除所有线程任务
|
||||
*/
|
||||
public void removeAllThreadTask() {
|
||||
if (mThreadTasks.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LOCK.tryLock(2, TimeUnit.SECONDS);
|
||||
for (Set<FutureContainer> threads : mThreadTasks.values()) {
|
||||
for (FutureContainer container : threads) {
|
||||
if (container.future.isDone() || container.future.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
container.threadTask.destroy();
|
||||
}
|
||||
threads.clear();
|
||||
}
|
||||
mThreadTasks.clear();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
LOCK.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动线程任务
|
||||
*
|
||||
|
||||
@@ -112,7 +112,7 @@ public abstract class AbsTaskQueue<TASK extends AbsTask, TASK_WRAPPER extends Ab
|
||||
task.stop(TaskSchedulerType.TYPE_STOP_NOT_NEXT);
|
||||
}
|
||||
}
|
||||
|
||||
ThreadTaskManager.getInstance().removeAllThreadTask();
|
||||
mCachePool.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user