270 lines
8.8 KiB
Java
270 lines
8.8 KiB
Java
package o;
|
|
|
|
import android.os.Process;
|
|
import android.os.StrictMode;
|
|
import android.text.TextUtils;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Future;
|
|
import java.util.concurrent.PriorityBlockingQueue;
|
|
import java.util.concurrent.SynchronousQueue;
|
|
import java.util.concurrent.ThreadFactory;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeoutException;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
/* renamed from: o.Rjq, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class ExecutorServiceC0913Rjq implements ExecutorService {
|
|
private static final long b = TimeUnit.SECONDS.toMillis(10);
|
|
private static volatile int d;
|
|
private final ExecutorService e;
|
|
|
|
public static ExecutorServiceC0913Rjq b() {
|
|
return new ExecutorServiceC0913Rjq(new ThreadPoolExecutor(0, Integer.MAX_VALUE, b, TimeUnit.MILLISECONDS, new SynchronousQueue(), new RVV(new HBt((byte) 0), "source-unlimited", Sts.b, false)));
|
|
}
|
|
|
|
ExecutorServiceC0913Rjq(ExecutorService executorService) {
|
|
this.e = executorService;
|
|
}
|
|
|
|
@Override // java.util.concurrent.Executor
|
|
public final void execute(Runnable runnable) {
|
|
this.e.execute(runnable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final Future<?> submit(Runnable runnable) {
|
|
return this.e.submit(runnable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection) throws InterruptedException {
|
|
return this.e.invokeAll(collection);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection, long j, TimeUnit timeUnit) throws InterruptedException {
|
|
return this.e.invokeAll(collection, j, timeUnit);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final <T> T invokeAny(Collection<? extends Callable<T>> collection) throws InterruptedException, ExecutionException {
|
|
return (T) this.e.invokeAny(collection);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final <T> T invokeAny(Collection<? extends Callable<T>> collection, long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
|
|
return (T) this.e.invokeAny(collection, j, timeUnit);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final <T> Future<T> submit(Runnable runnable, T t) {
|
|
return this.e.submit(runnable, t);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final <T> Future<T> submit(Callable<T> callable) {
|
|
return this.e.submit(callable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final void shutdown() {
|
|
this.e.shutdown();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final List<Runnable> shutdownNow() {
|
|
return this.e.shutdownNow();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final boolean isShutdown() {
|
|
return this.e.isShutdown();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final boolean isTerminated() {
|
|
return this.e.isTerminated();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public final boolean awaitTermination(long j, TimeUnit timeUnit) throws InterruptedException {
|
|
return this.e.awaitTermination(j, timeUnit);
|
|
}
|
|
|
|
public final String toString() {
|
|
return this.e.toString();
|
|
}
|
|
|
|
/* renamed from: o.Rjq$Sts */
|
|
/* loaded from: classes.dex */
|
|
public interface Sts {
|
|
public static final Sts b;
|
|
|
|
void a(Throwable th);
|
|
|
|
static {
|
|
new Sts() { // from class: o.Rjq.Sts.5
|
|
@Override // o.ExecutorServiceC0913Rjq.Sts
|
|
public final void a(Throwable th) {
|
|
}
|
|
};
|
|
Sts sts = new Sts() { // from class: o.Rjq.Sts.1
|
|
@Override // o.ExecutorServiceC0913Rjq.Sts
|
|
public final void a(Throwable th) {
|
|
}
|
|
};
|
|
new Sts() { // from class: o.Rjq.Sts.4
|
|
@Override // o.ExecutorServiceC0913Rjq.Sts
|
|
public final void a(Throwable th) {
|
|
throw new RuntimeException("Request threw uncaught throwable", th);
|
|
}
|
|
};
|
|
b = sts;
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.Rjq$HBt */
|
|
/* loaded from: classes.dex */
|
|
static final class HBt implements ThreadFactory {
|
|
private HBt() {
|
|
}
|
|
|
|
/* synthetic */ HBt(byte b) {
|
|
this();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public final Thread newThread(Runnable runnable) {
|
|
return new Thread(this, runnable) { // from class: o.Rjq.HBt.5
|
|
private HBt a;
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // java.lang.Thread, java.lang.Runnable
|
|
public final void run() {
|
|
Process.setThreadPriority(9);
|
|
super.run();
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: o.Rjq$RVV */
|
|
/* loaded from: classes.dex */
|
|
public static final class RVV implements ThreadFactory {
|
|
final boolean a;
|
|
private final String b;
|
|
final Sts c;
|
|
private final ThreadFactory d;
|
|
private final AtomicInteger e = new AtomicInteger();
|
|
|
|
RVV(ThreadFactory threadFactory, String str, Sts sts, boolean z) {
|
|
this.d = threadFactory;
|
|
this.b = str;
|
|
this.c = sts;
|
|
this.a = z;
|
|
}
|
|
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public final Thread newThread(Runnable runnable) {
|
|
Thread newThread = this.d.newThread(new Runnable(this, runnable) { // from class: o.Rjq.RVV.5
|
|
private RVV b;
|
|
private Runnable c;
|
|
|
|
{
|
|
this.b = this;
|
|
this.c = runnable;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
if (this.b.a) {
|
|
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().penaltyDeath().build());
|
|
}
|
|
try {
|
|
this.c.run();
|
|
} catch (Throwable th) {
|
|
this.b.c.a(th);
|
|
}
|
|
}
|
|
});
|
|
StringBuilder sb = new StringBuilder("glide-");
|
|
sb.append(this.b);
|
|
sb.append("-thread-");
|
|
sb.append(this.e.getAndIncrement());
|
|
newThread.setName(sb.toString());
|
|
return newThread;
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.Rjq$LWm */
|
|
/* loaded from: classes.dex */
|
|
public static final class LWm {
|
|
int a;
|
|
int c;
|
|
private final boolean d;
|
|
String e;
|
|
private long g;
|
|
private final ThreadFactory b = new HBt(0);
|
|
private Sts i = Sts.b;
|
|
|
|
LWm(boolean z) {
|
|
this.d = z;
|
|
}
|
|
|
|
public final ExecutorServiceC0913Rjq e() {
|
|
if (TextUtils.isEmpty(this.e)) {
|
|
StringBuilder sb = new StringBuilder("Name must be non-null and non-empty, but given: ");
|
|
sb.append(this.e);
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(this.c, this.a, this.g, TimeUnit.MILLISECONDS, new PriorityBlockingQueue(), new RVV(this.b, this.e, this.i, this.d));
|
|
if (this.g != 0) {
|
|
threadPoolExecutor.allowCoreThreadTimeOut(true);
|
|
}
|
|
return new ExecutorServiceC0913Rjq(threadPoolExecutor);
|
|
}
|
|
}
|
|
|
|
public static ExecutorServiceC0913Rjq d() {
|
|
if (d == 0) {
|
|
d = Math.min(4, Runtime.getRuntime().availableProcessors());
|
|
}
|
|
int i = d >= 4 ? 2 : 1;
|
|
LWm lWm = new LWm(true);
|
|
lWm.c = i;
|
|
lWm.a = i;
|
|
lWm.e = "animation";
|
|
return lWm.e();
|
|
}
|
|
|
|
public static ExecutorServiceC0913Rjq a() {
|
|
LWm lWm = new LWm(true);
|
|
lWm.c = 1;
|
|
lWm.a = 1;
|
|
lWm.e = "disk-cache";
|
|
return lWm.e();
|
|
}
|
|
|
|
public static ExecutorServiceC0913Rjq e() {
|
|
LWm lWm = new LWm(false);
|
|
if (d == 0) {
|
|
d = Math.min(4, Runtime.getRuntime().availableProcessors());
|
|
}
|
|
int i = d;
|
|
lWm.c = i;
|
|
lWm.a = i;
|
|
lWm.e = "source";
|
|
return lWm.e();
|
|
}
|
|
}
|