discord-jadx/app/src/main/java/y/b.java

78 lines
2.5 KiB
Java
Raw Normal View History

2021-10-15 06:18:26 +00:00
package y;
2021-08-03 07:33:18 +00:00
import java.util.Locale;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/* compiled from: BoltsExecutors */
public final class b {
public static final b a = new b();
public final ExecutorService b;
/* renamed from: c reason: collision with root package name */
2021-10-29 07:19:59 +00:00
public final Executor f3153c;
2021-08-03 07:33:18 +00:00
/* compiled from: BoltsExecutors */
2021-10-15 06:18:26 +00:00
/* renamed from: y.b$b reason: collision with other inner class name */
2021-10-20 06:51:20 +00:00
public static class ExecutorC0365b implements Executor {
2021-08-03 07:33:18 +00:00
public ThreadLocal<Integer> i = new ThreadLocal<>();
2021-10-20 06:51:20 +00:00
public ExecutorC0365b(a aVar) {
2021-08-03 07:33:18 +00:00
}
public final int a() {
Integer num = this.i.get();
if (num == null) {
num = 0;
}
int intValue = num.intValue() - 1;
if (intValue == 0) {
this.i.remove();
} else {
this.i.set(Integer.valueOf(intValue));
}
return intValue;
}
@Override // java.util.concurrent.Executor
public void execute(Runnable runnable) {
Integer num = this.i.get();
if (num == null) {
num = 0;
}
int intValue = num.intValue() + 1;
this.i.set(Integer.valueOf(intValue));
if (intValue <= 15) {
try {
runnable.run();
} catch (Throwable th) {
a();
throw th;
}
} else {
b.a.b.execute(runnable);
}
a();
}
}
public b() {
ThreadPoolExecutor threadPoolExecutor;
String property = System.getProperty("java.runtime.name");
if (!(property == null ? false : property.toLowerCase(Locale.US).contains("android"))) {
threadPoolExecutor = Executors.newCachedThreadPool();
} else {
a aVar = a.a;
2021-10-29 07:19:59 +00:00
ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(a.f3152c, a.d, 1, TimeUnit.SECONDS, new LinkedBlockingQueue());
2021-08-03 07:33:18 +00:00
threadPoolExecutor2.allowCoreThreadTimeOut(true);
threadPoolExecutor = threadPoolExecutor2;
}
this.b = threadPoolExecutor;
Executors.newSingleThreadScheduledExecutor();
2021-10-29 07:19:59 +00:00
this.f3153c = new ExecutorC0365b(null);
2021-08-03 07:33:18 +00:00
}
}