package z; 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 */ public final Executor f2895c; /* compiled from: BoltsExecutors */ /* renamed from: z.b$b reason: collision with other inner class name */ public static class ExecutorC0359b implements Executor { public ThreadLocal i = new ThreadLocal<>(); public ExecutorC0359b(a aVar) { } 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; ThreadPoolExecutor threadPoolExecutor2 = new ThreadPoolExecutor(a.f2894c, a.d, 1, TimeUnit.SECONDS, new LinkedBlockingQueue()); threadPoolExecutor2.allowCoreThreadTimeOut(true); threadPoolExecutor = threadPoolExecutor2; } this.b = threadPoolExecutor; Executors.newSingleThreadScheduledExecutor(); this.f2895c = new ExecutorC0359b(null); } }