what-the-bank/sources/o/DqI.java

117 lines
4.0 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.os.Process;
import java.util.concurrent.BlockingQueue;
import o.InterfaceC17333vqS;
/* loaded from: classes.dex */
public final class DqI extends Thread {
private static final boolean d = qWd.a;
private final qNX a;
public volatile boolean b = false;
private final InterfaceC17333vqS c;
private final BlockingQueue<HJP<?>> e;
private final BlockingQueue<HJP<?>> g;
private final C15640hOs h;
public DqI(BlockingQueue<HJP<?>> blockingQueue, BlockingQueue<HJP<?>> blockingQueue2, InterfaceC17333vqS interfaceC17333vqS, qNX qnx) {
this.e = blockingQueue;
this.g = blockingQueue2;
this.c = interfaceC17333vqS;
this.a = qnx;
this.h = new C15640hOs(this, blockingQueue2, qnx);
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
if (d) {
qWd.e("start new dispatcher", new Object[0]);
}
Process.setThreadPriority(10);
this.c.c();
while (true) {
try {
c();
} catch (InterruptedException unused) {
if (this.b) {
Thread.currentThread().interrupt();
return;
}
qWd.a("Ignoring spurious interrupt of CacheDispatcher thread; use quit() to terminate it", new Object[0]);
}
}
}
private void c() throws InterruptedException {
HJP<?> take = this.e.take();
take.addMarker("cache-queue-take");
take.sendEvent(1);
try {
if (take.isCanceled()) {
take.finish("cache-discard-canceled");
return;
}
InterfaceC17333vqS.IeS d2 = this.c.d(take.getCacheKey());
if (d2 == null) {
take.addMarker("cache-miss");
if (!this.h.c(take)) {
this.g.put(take);
}
return;
}
long currentTimeMillis = System.currentTimeMillis();
if (d2.f < currentTimeMillis) {
take.addMarker("cache-hit-expired");
take.setCacheEntry(d2);
if (!this.h.c(take)) {
this.g.put(take);
}
return;
}
take.addMarker("cache-hit");
C15788ibz<?> parseNetworkResponse = take.parseNetworkResponse(new DrQ(d2.a, d2.c));
take.addMarker("cache-hit-parsed");
if (parseNetworkResponse.d != null) {
take.addMarker("cache-parsing-failed");
this.c.a(take.getCacheKey());
take.setCacheEntry(null);
if (!this.h.c(take)) {
this.g.put(take);
}
return;
}
if (d2.i < currentTimeMillis) {
take.addMarker("cache-hit-refresh-needed");
take.setCacheEntry(d2);
parseNetworkResponse.b = true;
if (this.h.c(take)) {
this.a.e(take, parseNetworkResponse);
} else {
this.a.d(take, parseNetworkResponse, new Runnable(this, take) { // from class: o.DqI.2
private DqI c;
private HJP e;
{
this.c = this;
this.e = take;
}
@Override // java.lang.Runnable
public final void run() {
try {
this.c.g.put(this.e);
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
}
}
});
}
} else {
this.a.e(take, parseNetworkResponse);
}
} finally {
take.sendEvent(2);
}
}
}