- 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
121 lines
3.3 KiB
Java
121 lines
3.3 KiB
Java
package com.mbridge.msdk.tracker.network;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.PriorityBlockingQueue;
|
|
import java.util.concurrent.ThreadFactory;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class v {
|
|
private volatile ThreadPoolExecutor a;
|
|
private final int e;
|
|
private final b f;
|
|
private final n g;
|
|
private final x h;
|
|
private final AtomicInteger b = new AtomicInteger();
|
|
private final Set<u<?>> c = new HashSet();
|
|
private final PriorityBlockingQueue<u<?>> d = new PriorityBlockingQueue<>();
|
|
private final List<a> i = new ArrayList();
|
|
|
|
public interface a {
|
|
void a(u<?> uVar, int i);
|
|
}
|
|
|
|
public v(n nVar, x xVar, int i, b bVar) {
|
|
this.e = i;
|
|
this.f = bVar;
|
|
this.g = nVar;
|
|
this.h = xVar;
|
|
}
|
|
|
|
public final void a() {
|
|
this.a = null;
|
|
a(this.e);
|
|
}
|
|
|
|
private void a(int i) {
|
|
if (this.a != null) {
|
|
return;
|
|
}
|
|
try {
|
|
b(i);
|
|
if (this.a == null) {
|
|
return;
|
|
}
|
|
} catch (Throwable unused) {
|
|
try {
|
|
b(5);
|
|
} catch (Exception unused2) {
|
|
} catch (Throwable th) {
|
|
if (this.a != null) {
|
|
this.a.allowCoreThreadTimeOut(true);
|
|
}
|
|
throw th;
|
|
}
|
|
if (this.a == null) {
|
|
return;
|
|
}
|
|
}
|
|
this.a.allowCoreThreadTimeOut(true);
|
|
}
|
|
|
|
private void b(int i) {
|
|
this.a = new ThreadPoolExecutor(i, i, 100L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new ThreadFactory() { // from class: com.mbridge.msdk.tracker.network.v.1
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public final Thread newThread(Runnable runnable) {
|
|
return new Thread(runnable, "NetworkDispatcher");
|
|
}
|
|
}, new ThreadPoolExecutor.DiscardPolicy());
|
|
}
|
|
|
|
public final <T> u<T> a(u<T> uVar) {
|
|
uVar.a(this);
|
|
synchronized (this.c) {
|
|
this.c.add(uVar);
|
|
}
|
|
uVar.c(this.b.incrementAndGet());
|
|
a(uVar, 0);
|
|
this.d.add(uVar);
|
|
if (this.a == null) {
|
|
a(this.e);
|
|
}
|
|
this.a.execute(new Runnable() { // from class: com.mbridge.msdk.tracker.network.v.2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
try {
|
|
new o(v.this.d, v.this.g, v.this.f, v.this.h).run();
|
|
} catch (Throwable unused) {
|
|
}
|
|
}
|
|
});
|
|
return uVar;
|
|
}
|
|
|
|
public final <T> void b(u<T> uVar) {
|
|
synchronized (this.c) {
|
|
this.c.remove(uVar);
|
|
}
|
|
a(uVar, 5);
|
|
}
|
|
|
|
public final void a(u<?> uVar, int i) {
|
|
synchronized (this.i) {
|
|
try {
|
|
Iterator<a> it = this.i.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().a(uVar, i);
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
}
|