jimu-decompiled/sources/com/baidu/uaq/agent/android/g.java
2025-05-13 19:24:51 +02:00

70 lines
2.6 KiB
Java

package com.baidu.uaq.agent.android;
import com.baidu.uaq.agent.android.harvest.bean.h;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/* compiled from: TaskQueue.java */
/* loaded from: classes.dex */
public class g {
private static final com.baidu.uaq.agent.android.logging.a a = com.baidu.uaq.agent.android.logging.b.a();
private static final UAQ b = UAQ.getInstance();
private static final ScheduledExecutorService c = Executors.newSingleThreadScheduledExecutor(new com.baidu.uaq.agent.android.util.g("TaskQueue"));
private static final ConcurrentLinkedQueue<Object> d = new ConcurrentLinkedQueue<>();
private static final Runnable e = new Runnable() { // from class: com.baidu.uaq.agent.android.g.1
@Override // java.lang.Runnable
public void run() {
g.c();
}
};
private static Future f;
public static void a(Object obj) {
if (com.baidu.uaq.agent.android.harvest.multiharvest.a.c().a() < 0 || b.isDisableCollect() || f == null) {
return;
}
d.add(obj);
}
public static void b() {
Future future = f;
if (future != null) {
future.cancel(true);
f = null;
a.d("TaskQueue stop");
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void c() {
if (d.size() == 0) {
return;
}
while (!d.isEmpty()) {
try {
Object remove = d.remove();
if (remove instanceof com.baidu.uaq.agent.android.harvest.health.b) {
com.baidu.uaq.agent.android.harvest.multiharvest.d.a((com.baidu.uaq.agent.android.harvest.health.b) remove);
} else if (remove instanceof h) {
com.baidu.uaq.agent.android.harvest.multiharvest.d.a((h) remove);
} else if (remove instanceof com.baidu.uaq.agent.android.harvest.bean.f) {
com.baidu.uaq.agent.android.harvest.multiharvest.d.a((com.baidu.uaq.agent.android.harvest.bean.f) remove);
}
} catch (Exception e2) {
a.a("Caught error while TaskQueue dequeue: ", e2);
com.baidu.uaq.agent.android.harvest.health.a.a(e2);
}
}
}
public static void a() {
if (f == null) {
f = c.scheduleAtFixedRate(e, 0L, 1000L, TimeUnit.MILLISECONDS);
a.d("TaskQueue start");
}
}
}