[线程优化]删除相关配置

This commit is contained in:
renwj
2022-09-15 19:50:22 +08:00
parent 398b7e4324
commit 5fbef0e33f
2 changed files with 48 additions and 48 deletions

View File

@@ -33,19 +33,19 @@ if (!isAndroidTestBuild()) {
apply plugin: 'apm-plugin'
}
if (!isAndroidTestBuild()) {
apply plugin: 'bytex.threadOpt'
thread_opt {
enable true
enableInDebug true
logLevel "DEBUG"
//白名单中的类不进行替换
white_list = [
'leakcanary.*',
'com.loc.*'
]
}
}
//if (!isAndroidTestBuild()) {
// apply plugin: 'bytex.threadOpt'
// thread_opt {
// enable true
// enableInDebug true
// logLevel "DEBUG"
// //白名单中的类不进行替换
// white_list = [
// 'leakcanary.*',
// 'com.loc.*'
// ]
// }
//}
//if (!isAndroidTestBuild()) {
// /**

View File

@@ -3,14 +3,14 @@ package com.mogo.launcher;
import com.mogo.eagle.core.function.main.MainMoGoApplication;
import android.content.Context;
import androidx.annotation.NonNull;
//import androidx.annotation.NonNull;
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.launcher.crash.CrashSystem;
import com.mogo.thread.ext.core.ThreadManager;
import com.mogo.thread.ext.core.config.ThreadConfig;
import java.util.concurrent.ThreadPoolExecutor;
//import com.mogo.thread.ext.core.ThreadManager;
//import com.mogo.thread.ext.core.config.ThreadConfig;
//
//import java.util.concurrent.ThreadPoolExecutor;
/**
* @author congtaowang
@@ -23,36 +23,36 @@ public class MogoApplication extends MainMoGoApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ThreadConfig.Builder builder = new ThreadConfig.Builder().listener(new ThreadConfig.TaskExecuteListener() {
@Override
public boolean isEnabled() {
return true; // 如果返回true会有后续的回调如果返回false, 不会有后续的回调
}
@Override
public void onExecutorBefore(@NonNull Runnable runnable) {
//每个任务执行前回调
}
@Override
public void onExecutorAfter(@NonNull Runnable runnable) {
//每个任务执行后回调
}
/**
* @param core 线程池的核心数
* @param max 线程池的最大线程数
* @param active 线程池正在活跃的任务数
* @param completed 线程池已完成的任务数
*/
@Override
public void onExecutorStateChanged(@NonNull ThreadPoolExecutor pool, int core, int max, int active, long completed) {
//线程池在执行过程,状态变化回调
//Log.d("POOL", "core:" + core + ";max:" + max + ";active:" + active + ";completed:" + completed);
}
});
builder.loggable(false);
ThreadManager.INSTANCE.init(builder);
// ThreadConfig.Builder builder = new ThreadConfig.Builder().listener(new ThreadConfig.TaskExecuteListener() {
// @Override
// public boolean isEnabled() {
// return true; // 如果返回true会有后续的回调如果返回false, 不会有后续的回调
// }
//
// @Override
// public void onExecutorBefore(@NonNull Runnable runnable) {
// //每个任务执行前回调
// }
//
// @Override
// public void onExecutorAfter(@NonNull Runnable runnable) {
// //每个任务执行后回调
// }
//
// /**
// * @param core 线程池的核心数
// * @param max 线程池的最大线程数
// * @param active 线程池正在活跃的任务数
// * @param completed 线程池已完成的任务数
// */
// @Override
// public void onExecutorStateChanged(@NonNull ThreadPoolExecutor pool, int core, int max, int active, long completed) {
// //线程池在执行过程,状态变化回调
// //Log.d("POOL", "core:" + core + ";max:" + max + ";active:" + active + ";completed:" + completed);
// }
// });
// builder.loggable(false);
// ThreadManager.INSTANCE.init(builder);
}
@Override