- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
97 lines
3.5 KiB
Java
97 lines
3.5 KiB
Java
package com.mbridge.msdk.foundation.same.e;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import com.mbridge.msdk.foundation.same.e.a;
|
|
import com.mbridge.msdk.foundation.tools.ah;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.concurrent.LinkedBlockingDeque;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class b {
|
|
ThreadPoolExecutor a;
|
|
HashMap<Long, a> b;
|
|
WeakReference<Context> c;
|
|
|
|
@SuppressLint({"UseSparseArrays"})
|
|
public b(Context context, int i) {
|
|
if (ah.a().a("c_t_l_t_p", true)) {
|
|
this.a = c.a();
|
|
} else {
|
|
if (i == 0) {
|
|
this.a = new ThreadPoolExecutor(1, 5, 15L, TimeUnit.SECONDS, new LinkedBlockingDeque(), new ThreadPoolExecutor.DiscardPolicy());
|
|
} else {
|
|
this.a = new ThreadPoolExecutor(i, (i * 2) + 1, 15L, TimeUnit.SECONDS, new LinkedBlockingDeque(), new ThreadPoolExecutor.DiscardPolicy());
|
|
}
|
|
this.a.allowCoreThreadTimeOut(true);
|
|
}
|
|
this.b = new HashMap<>();
|
|
this.c = new WeakReference<>(context);
|
|
}
|
|
|
|
@SuppressLint({"UseSparseArrays"})
|
|
public b(Context context) {
|
|
if (ah.a().a("c_t_l_t_p", true)) {
|
|
this.a = c.a();
|
|
} else {
|
|
if (ah.a().a("c_t_p_t_l", true)) {
|
|
int availableProcessors = (Runtime.getRuntime().availableProcessors() * 2) + 1;
|
|
this.a = new ThreadPoolExecutor(availableProcessors, availableProcessors, 15L, TimeUnit.SECONDS, new LinkedBlockingDeque(), new ThreadPoolExecutor.DiscardPolicy());
|
|
} else {
|
|
this.a = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 15L, TimeUnit.SECONDS, new LinkedBlockingDeque(), new ThreadPoolExecutor.DiscardPolicy());
|
|
}
|
|
this.a.allowCoreThreadTimeOut(true);
|
|
}
|
|
this.b = new HashMap<>();
|
|
this.c = new WeakReference<>(context);
|
|
}
|
|
|
|
public final void a(a aVar) {
|
|
b(aVar, null);
|
|
this.a.execute(aVar);
|
|
}
|
|
|
|
private synchronized void b(final a aVar, final a.InterfaceC0199a interfaceC0199a) {
|
|
this.b.put(Long.valueOf(aVar.getId()), aVar);
|
|
aVar.setOnStateChangeListener(new a.InterfaceC0199a() { // from class: com.mbridge.msdk.foundation.same.e.b.1
|
|
@Override // com.mbridge.msdk.foundation.same.e.a.InterfaceC0199a
|
|
public final void a(a.b bVar) {
|
|
if (bVar == a.b.CANCEL) {
|
|
b.this.b.remove(Long.valueOf(aVar.getId()));
|
|
} else if (bVar == a.b.FINISH) {
|
|
b.this.b.remove(Long.valueOf(aVar.getId()));
|
|
} else if (bVar == a.b.RUNNING && b.this.c.get() == null) {
|
|
b.this.a();
|
|
}
|
|
a.InterfaceC0199a interfaceC0199a2 = interfaceC0199a;
|
|
if (interfaceC0199a2 != null) {
|
|
interfaceC0199a2.a(bVar);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public final synchronized void a() {
|
|
try {
|
|
Iterator<Map.Entry<Long, a>> it = this.b.entrySet().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().getValue().cancel();
|
|
}
|
|
this.b.clear();
|
|
} catch (Exception unused) {
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final void a(a aVar, a.InterfaceC0199a interfaceC0199a) {
|
|
b(aVar, interfaceC0199a);
|
|
this.a.execute(aVar);
|
|
}
|
|
}
|