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

78 lines
2.5 KiB
Java
Raw Normal View History

2021-11-02 06:38:17 +00:00
package z;
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;
2022-03-07 09:34:54 +00:00
/* compiled from: BoltsExecutors.java */
/* loaded from: classes.dex */
2021-08-03 07:33:18 +00:00
public final class b {
public static final b a = new b();
2021-12-17 21:59:34 +00:00
/* renamed from: b reason: collision with root package name */
2022-03-28 08:10:50 +00:00
public final ExecutorService f3851b;
2021-12-17 21:59:34 +00:00
public final Executor c;
2021-08-03 07:33:18 +00:00
2022-03-07 09:34:54 +00:00
/* compiled from: BoltsExecutors.java */
2021-11-02 06:38:17 +00:00
/* renamed from: z.b$b reason: collision with other inner class name */
2022-03-07 09:34:54 +00:00
/* loaded from: classes.dex */
2022-03-21 18:52:30 +00:00
public static class ExecutorC0438b implements Executor {
2021-12-02 18:53:44 +00:00
public ThreadLocal<Integer> j = new ThreadLocal<>();
2021-08-03 07:33:18 +00:00
2022-03-21 18:52:30 +00:00
public ExecutorC0438b(a aVar) {
2021-08-03 07:33:18 +00:00
}
public final int a() {
2021-12-02 18:53:44 +00:00
Integer num = this.j.get();
2021-08-03 07:33:18 +00:00
if (num == null) {
num = 0;
}
int intValue = num.intValue() - 1;
if (intValue == 0) {
2021-12-02 18:53:44 +00:00
this.j.remove();
2021-08-03 07:33:18 +00:00
} else {
2021-12-02 18:53:44 +00:00
this.j.set(Integer.valueOf(intValue));
2021-08-03 07:33:18 +00:00
}
return intValue;
}
@Override // java.util.concurrent.Executor
public void execute(Runnable runnable) {
2021-12-02 18:53:44 +00:00
Integer num = this.j.get();
2021-08-03 07:33:18 +00:00
if (num == null) {
num = 0;
}
int intValue = num.intValue() + 1;
2021-12-02 18:53:44 +00:00
this.j.set(Integer.valueOf(intValue));
2022-03-07 09:34:54 +00:00
try {
if (intValue <= 15) {
2021-08-03 07:33:18 +00:00
runnable.run();
2022-03-07 09:34:54 +00:00
} else {
2022-03-28 08:10:50 +00:00
b.a.f3851b.execute(runnable);
2021-08-03 07:33:18 +00:00
}
2022-03-07 09:34:54 +00:00
} finally {
a();
2021-08-03 07:33:18 +00:00
}
}
}
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;
2022-03-07 09:34:54 +00:00
ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(a.c, a.d, 1L, TimeUnit.SECONDS, new LinkedBlockingQueue());
2021-08-03 07:33:18 +00:00
threadPoolExecutor2.allowCoreThreadTimeOut(true);
threadPoolExecutor = threadPoolExecutor2;
}
2022-03-28 08:10:50 +00:00
this.f3851b = threadPoolExecutor;
2021-08-03 07:33:18 +00:00
Executors.newSingleThreadScheduledExecutor();
2022-03-21 18:52:30 +00:00
this.c = new ExecutorC0438b(null);
2021-08-03 07:33:18 +00:00
}
}