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;
|
|
|
|
/* 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-12-03 20:28:00 +00:00
|
|
|
public final Executor f3063c;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
|
|
|
/* compiled from: BoltsExecutors */
|
2021-11-02 06:38:17 +00:00
|
|
|
/* renamed from: z.b$b reason: collision with other inner class name */
|
2021-12-02 18:53:44 +00:00
|
|
|
public static class ExecutorC0366b implements Executor {
|
|
|
|
public ThreadLocal<Integer> j = new ThreadLocal<>();
|
2021-08-03 07:33:18 +00:00
|
|
|
|
2021-12-02 18:53:44 +00:00
|
|
|
public ExecutorC0366b(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));
|
2021-08-03 07:33:18 +00:00
|
|
|
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-12-03 20:28:00 +00:00
|
|
|
ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(a.f3062c, 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-12-03 20:28:00 +00:00
|
|
|
this.f3063c = new ExecutorC0366b(null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|