31 lines
1.0 KiB
Java
31 lines
1.0 KiB
Java
package com.baidu.uaq.agent.android.util;
|
|
|
|
import java.util.concurrent.ThreadFactory;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
/* compiled from: NamedThreadFactory.java */
|
|
/* loaded from: classes.dex */
|
|
public class g implements ThreadFactory {
|
|
private final ThreadGroup a;
|
|
private final String b;
|
|
private final AtomicInteger c = new AtomicInteger(1);
|
|
|
|
public g(String str) {
|
|
SecurityManager securityManager = System.getSecurityManager();
|
|
this.a = securityManager == null ? Thread.currentThread().getThreadGroup() : securityManager.getThreadGroup();
|
|
this.b = "APM_" + str + "-";
|
|
}
|
|
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public Thread newThread(Runnable runnable) {
|
|
Thread thread = new Thread(this.a, runnable, this.b + this.c.getAndIncrement(), 0L);
|
|
if (thread.isDaemon()) {
|
|
thread.setDaemon(false);
|
|
}
|
|
if (thread.getPriority() != 5) {
|
|
thread.setPriority(5);
|
|
}
|
|
return thread;
|
|
}
|
|
}
|