jimu-decompiled/sources/com/google/android/gms/measurement/internal/zzbv.java
2025-05-13 19:24:51 +02:00

127 lines
4.0 KiB
Java

package com.google.android.gms.measurement.internal;
import android.os.Process;
import com.google.android.gms.common.internal.Preconditions;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Semaphore;
/* loaded from: classes.dex */
final class zzbv extends Thread {
private final Object a;
private final BlockingQueue<zzbu<?>> b;
private final /* synthetic */ zzbr c;
public zzbv(zzbr zzbrVar, String str, BlockingQueue<zzbu<?>> blockingQueue) {
this.c = zzbrVar;
Preconditions.a(str);
Preconditions.a(blockingQueue);
this.a = new Object();
this.b = blockingQueue;
setName(str);
}
public final void a() {
synchronized (this.a) {
this.a.notifyAll();
}
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
Object obj;
Semaphore semaphore;
Object obj2;
zzbv zzbvVar;
zzbv zzbvVar2;
Object obj3;
Object obj4;
Semaphore semaphore2;
Object obj5;
zzbv zzbvVar3;
zzbv zzbvVar4;
boolean z;
Semaphore semaphore3;
boolean z2 = false;
while (!z2) {
try {
semaphore3 = this.c.j;
semaphore3.acquire();
z2 = true;
} catch (InterruptedException e) {
a(e);
}
}
try {
int threadPriority = Process.getThreadPriority(Process.myTid());
while (true) {
zzbu<?> poll = this.b.poll();
if (poll == null) {
synchronized (this.a) {
if (this.b.peek() == null) {
z = this.c.k;
if (!z) {
try {
this.a.wait(30000L);
} catch (InterruptedException e2) {
a(e2);
}
}
}
}
obj3 = this.c.i;
synchronized (obj3) {
if (this.b.peek() == null) {
break;
}
}
} else {
Process.setThreadPriority(poll.b ? threadPriority : 10);
poll.run();
}
}
obj4 = this.c.i;
synchronized (obj4) {
semaphore2 = this.c.j;
semaphore2.release();
obj5 = this.c.i;
obj5.notifyAll();
zzbvVar3 = this.c.c;
if (this == zzbvVar3) {
zzbr.a(this.c, null);
} else {
zzbvVar4 = this.c.d;
if (this == zzbvVar4) {
zzbr.b(this.c, null);
} else {
this.c.e().t().a("Current scheduler thread is neither worker nor network");
}
}
}
} catch (Throwable th) {
obj = this.c.i;
synchronized (obj) {
semaphore = this.c.j;
semaphore.release();
obj2 = this.c.i;
obj2.notifyAll();
zzbvVar = this.c.c;
if (this != zzbvVar) {
zzbvVar2 = this.c.d;
if (this == zzbvVar2) {
zzbr.b(this.c, null);
} else {
this.c.e().t().a("Current scheduler thread is neither worker nor network");
}
} else {
zzbr.a(this.c, null);
}
throw th;
}
}
}
private final void a(InterruptedException interruptedException) {
this.c.e().w().a(String.valueOf(getName()).concat(" was interrupted"), interruptedException);
}
}