package a.b.a.i;

import android.os.SystemClock;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class k {
    private static final String b = "WorkThread";
    private static final int c = 0;
    private static final int d = Integer.MAX_VALUE;
    private static final int e = 20;
    private static final TimeUnit f = TimeUnit.SECONDS;
    private static final BlockingQueue<Runnable> g = new SynchronousQueue();

    /* renamed from: a  reason: collision with root package name */
    private ExecutorService f39a;

    public class a implements Runnable {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ String f40a;
        public final /* synthetic */ Runnable b;

        public a(String str, Runnable runnable) {
            this.f40a = str;
            this.b = runnable;
        }

        public void run() {
            long currentThreadTimeMillis = SystemClock.currentThreadTimeMillis();
            a.a.a.b.c(k.b, "Executing task: " + this.f40a + "[" + currentThreadTimeMillis + "]");
            this.b.run();
            a.a.a.b.c(k.b, "Task: " + this.f40a + "[" + currentThreadTimeMillis + "] executed.");
        }
    }

    public static class b {

        /* renamed from: a  reason: collision with root package name */
        public static k f41a = new k(null);
    }

    private k() {
        this.f39a = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 20, f, g);
    }

    public /* synthetic */ k(a aVar) {
        this();
    }

    public static void a(Runnable runnable, String str) {
        String str2;
        Throwable e2;
        a.a.a.b.c(b, "Submit task: " + str);
        try {
            b.f41a.f39a.submit(new a(str, runnable));
            return;
        } catch (RejectedExecutionException e3) {
            e2 = e3;
            str2 = "Submit runnable failed with RejectedExecutionException.";
        } catch (Exception e4) {
            e2 = e4;
            str2 = "Submit runnable failed.";
        }
        a.a.a.b.b(b, str2, e2);
    }
}
