package com.tencent.mm.pluginsdk.g.a.c;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.pluginsdk.g.a.c.f.c;
import com.tencent.mm.sdk.platformtools.ab;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RunnableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class f$a extends ThreadPoolExecutor {
    final /* synthetic */ f vfa;

    public f$a(f fVar, int i, int i2, long j, TimeUnit timeUnit, BlockingQueue<Runnable> blockingQueue, u uVar) {
        this.vfa = fVar;
        super(i, i2, j, timeUnit, blockingQueue, uVar);
    }

    /* Access modifiers changed, original: protected|final */
    public final <V> RunnableFuture<V> newTaskFor(Runnable runnable, V v) {
        AppMethodBeat.i(79567);
        if (runnable instanceof f$d) {
            c cVar = new c(runnable, v, ((f$d) runnable).vfb);
            AppMethodBeat.o(79567);
            return cVar;
        }
        RunnableFuture<V> newTaskFor = super.newTaskFor(runnable, v);
        AppMethodBeat.o(79567);
        return newTaskFor;
    }

    /* Access modifiers changed, original: protected|final */
    public final void terminated() {
        AppMethodBeat.i(79568);
        this.vfa.veZ.clear();
        super.terminated();
        AppMethodBeat.o(79568);
    }

    /* Access modifiers changed, original: protected|final */
    public final void beforeExecute(Thread thread, Runnable runnable) {
        AppMethodBeat.i(79569);
        if (runnable instanceof c) {
            c cVar = (c) runnable;
            if (this.vfa.veZ.containsKey(cVar.vfb.dib())) {
                cVar.cancel(false);
            } else {
                this.vfa.veZ.put(cVar.vfb.dib(), cVar);
                this.vfa.pendingRequests.remove(cVar.vfb.dib());
            }
        } else {
            ab.i("MicroMsg.ResDownloader.IOWorker", "r = %s is not RequestFutureTask<?>", new Object[]{runnable.getClass().getSimpleName()});
        }
        super.beforeExecute(thread, runnable);
        AppMethodBeat.o(79569);
    }

    /* Access modifiers changed, original: protected|final */
    public final void afterExecute(Runnable runnable, Throwable th) {
        AppMethodBeat.i(79570);
        if (runnable instanceof c) {
            c cVar = (c) runnable;
            this.vfa.veZ.remove(cVar.vfb.dib());
            this.vfa.pendingRequests.remove(cVar.vfb.dib());
        } else {
            ab.i("MicroMsg.ResDownloader.IOWorker", "r = %s is not RequestFutureTask<?>", new Object[]{runnable.getClass().getSimpleName()});
        }
        super.afterExecute(runnable, th);
        AppMethodBeat.o(79570);
    }
}
