package 㴹.K.Ԕ.ⁱ;

import io.reactivex.internal.disposables.EmptyDisposable;
import io.reactivex.internal.schedulers.ScheduledDirectTask;
import io.reactivex.internal.schedulers.ScheduledRunnable;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import ඓ.ⁱ.K.ඓ.C1252;
import 㴹.K.AbstractC2508;
import 㴹.K.Ԕ.K.AbstractC2486;
import 㴹.K.㑃.AbstractC2514;

/* renamed from: 㴹.K.Ԕ.ⁱ.㸾  reason: contains not printable characters */
/* compiled from: NewThreadWorker */
public class C2479 extends AbstractC2508.AbstractC2509 implements AbstractC2514 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public volatile boolean f8459;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final ScheduledExecutorService f8460;

    public C2479(ThreadFactory threadFactory) {
        this.f8460 = C2477.m6517(threadFactory);
    }

    @Override // 㴹.K.㑃.AbstractC2514
    public void dispose() {
        if (!this.f8459) {
            this.f8459 = true;
            this.f8460.shutdownNow();
        }
    }

    @Override // 㴹.K.㑃.AbstractC2514
    public boolean isDisposed() {
        return this.f8459;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public AbstractC2514 m6518(Runnable runnable, long j, TimeUnit timeUnit) {
        Future<?> future;
        ScheduledDirectTask scheduledDirectTask = new ScheduledDirectTask(C1252.m3339(runnable));
        if (j <= 0) {
            try {
                future = this.f8460.submit(scheduledDirectTask);
            } catch (RejectedExecutionException e) {
                C1252.m3349(e);
                return EmptyDisposable.INSTANCE;
            }
        } else {
            future = this.f8460.schedule(scheduledDirectTask, j, timeUnit);
        }
        scheduledDirectTask.setFuture(future);
        return scheduledDirectTask;
    }

    @Override // 㴹.K.AbstractC2508.AbstractC2509
    /* renamed from: K  reason: contains not printable characters */
    public AbstractC2514 m6520(Runnable runnable) {
        return m6521(runnable, 0, null);
    }

    @Override // 㴹.K.AbstractC2508.AbstractC2509
    /* renamed from: K  reason: contains not printable characters */
    public AbstractC2514 m6521(Runnable runnable, long j, TimeUnit timeUnit) {
        if (this.f8459) {
            return EmptyDisposable.INSTANCE;
        }
        return m6519(runnable, j, timeUnit, null);
    }

    /* renamed from: K  reason: contains not printable characters */
    public ScheduledRunnable m6519(Runnable runnable, long j, TimeUnit timeUnit, AbstractC2486 k) {
        Future<?> future;
        ScheduledRunnable scheduledRunnable = new ScheduledRunnable(C1252.m3339(runnable), k);
        if (k != null && !k.m6531(scheduledRunnable)) {
            return scheduledRunnable;
        }
        if (j <= 0) {
            try {
                future = this.f8460.submit((Callable) scheduledRunnable);
            } catch (RejectedExecutionException e) {
                if (k != null) {
                    k.m6532(scheduledRunnable);
                }
                C1252.m3349(e);
            }
        } else {
            future = this.f8460.schedule((Callable) scheduledRunnable, j, timeUnit);
        }
        scheduledRunnable.setFuture(future);
        return scheduledRunnable;
    }
}
