package com.adjust.sdk.scheduler;

import com.adjust.sdk.AdjustFactory;
import com.adjust.sdk.Constants;
import java.lang.Thread;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import ඓ.K.K.K.C1293;

public class ThreadFactoryWrapper implements ThreadFactory {
    public String source;

    public class a implements Thread.UncaughtExceptionHandler {
        public final void uncaughtException(Thread thread, Throwable th) {
            AdjustFactory.getLogger().error("Thread [%s] with error [%s]", thread.getName(), th.getMessage());
        }
    }

    public ThreadFactoryWrapper(String str) {
        this.source = str;
    }

    public Thread newThread(Runnable runnable) {
        Thread newThread = Executors.defaultThreadFactory().newThread(runnable);
        newThread.setPriority(9);
        StringBuilder r0 = C1293.m3416(Constants.THREAD_PREFIX);
        r0.append(newThread.getName());
        r0.append("-");
        r0.append(this.source);
        newThread.setName(r0.toString());
        newThread.setDaemon(true);
        newThread.setUncaughtExceptionHandler(new a());
        return newThread;
    }
}
