package io.netty.util.concurrent;

import g.a.a.a.a;
import io.netty.util.internal.ObjectUtil;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.lang.Thread;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

/* JADX INFO: loaded from: classes.dex */
public abstract class SingleThreadEventExecutor extends AbstractScheduledEventExecutor implements OrderedEventExecutor {
    public static final /* synthetic */ boolean $assertionsDisabled = false;
    private static final int ST_NOT_STARTED = 1;
    private static final int ST_SHUTDOWN = 4;
    private static final int ST_SHUTTING_DOWN = 3;
    private static final int ST_STARTED = 2;
    private static final int ST_TERMINATED = 5;
    private final boolean addTaskWakesUp;
    private final Executor executor;
    private volatile long gracefulShutdownQuietPeriod;
    private long gracefulShutdownStartTime;
    private volatile long gracefulShutdownTimeout;
    private volatile boolean interrupted;
    private long lastExecutionTime;
    private final int maxPendingTasks;
    private final RejectedExecutionHandler rejectedExecutionHandler;
    private final Set<Runnable> shutdownHooks;
    private volatile int state;
    private final Queue<Runnable> taskQueue;
    private final Promise<?> terminationFuture;
    private volatile Thread thread;
    private final Semaphore threadLock;
    private volatile ThreadProperties threadProperties;
    public static final int DEFAULT_MAX_PENDING_EXECUTOR_TASKS = Math.max(16, SystemPropertyUtil.getInt("io.netty.eventexecutor.maxPendingTasks", Integer.MAX_VALUE));
    private static final InternalLogger logger = InternalLoggerFactory.getInstance((Class<?>) SingleThreadEventExecutor.class);
    private static final Runnable WAKEUP_TASK = new Runnable() { // from class: io.netty.util.concurrent.SingleThreadEventExecutor.1
        @Override // java.lang.Runnable
        public void run() {
        }
    };
    private static final Runnable NOOP_TASK = new Runnable() { // from class: io.netty.util.concurrent.SingleThreadEventExecutor.2
        @Override // java.lang.Runnable
        public void run() {
        }
    };
    private static final AtomicIntegerFieldUpdater<SingleThreadEventExecutor> STATE_UPDATER = AtomicIntegerFieldUpdater.newUpdater(SingleThreadEventExecutor.class, "state");
    private static final AtomicReferenceFieldUpdater<SingleThreadEventExecutor, ThreadProperties> PROPERTIES_UPDATER = AtomicReferenceFieldUpdater.newUpdater(SingleThreadEventExecutor.class, ThreadProperties.class, "threadProperties");
    private static final long SCHEDULE_PURGE_INTERVAL = TimeUnit.SECONDS.toNanos(1);

    public static final class DefaultThreadProperties implements ThreadProperties {

        /* JADX INFO: renamed from: t, reason: collision with root package name */
        private final Thread f5817t;

        public DefaultThreadProperties(Thread thread) {
            this.f5817t = thread;
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public long id() {
            return this.f5817t.getId();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public boolean isAlive() {
            return this.f5817t.isAlive();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public boolean isDaemon() {
            return this.f5817t.isDaemon();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public boolean isInterrupted() {
            return this.f5817t.isInterrupted();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public String name() {
            return this.f5817t.getName();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public int priority() {
            return this.f5817t.getPriority();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public StackTraceElement[] stackTrace() {
            return this.f5817t.getStackTrace();
        }

        @Override // io.netty.util.concurrent.ThreadProperties
        public Thread.State state() {
            return this.f5817t.getState();
        }
    }

    public SingleThreadEventExecutor(EventExecutorGroup eventExecutorGroup, Executor executor, boolean z2) {
        this(eventExecutorGroup, executor, z2, DEFAULT_MAX_PENDING_EXECUTOR_TASKS, RejectedExecutionHandlers.reject());
    }

    public SingleThreadEventExecutor(EventExecutorGroup eventExecutorGroup, Executor executor, boolean z2, int i2, RejectedExecutionHandler rejectedExecutionHandler) {
        super(eventExecutorGroup);
        this.threadLock = new Semaphore(0);
        this.shutdownHooks = new LinkedHashSet();
        this.state = 1;
        this.terminationFuture = new DefaultPromise(GlobalEventExecutor.INSTANCE);
        this.addTaskWakesUp = z2;
        int iMax = Math.max(16, i2);
        this.maxPendingTasks = iMax;
        this.executor = (Executor) ObjectUtil.checkNotNull(executor, "executor");
        this.taskQueue = newTaskQueue(iMax);
        this.rejectedExecutionHandler = (RejectedExecutionHandler) ObjectUtil.checkNotNull(rejectedExecutionHandler, "rejectedHandler");
    }

    public SingleThreadEventExecutor(EventExecutorGroup eventExecutorGroup, ThreadFactory threadFactory, boolean z2) {
        this(eventExecutorGroup, new ThreadPerTaskExecutor(threadFactory), z2);
    }

    public SingleThreadEventExecutor(EventExecutorGroup eventExecutorGroup, ThreadFactory threadFactory, boolean z2, int i2, RejectedExecutionHandler rejectedExecutionHandler) {
        this(eventExecutorGroup, new ThreadPerTaskExecutor(threadFactory), z2, i2, rejectedExecutionHandler);
    }

    private void doStartThread() {
        this.executor.execute(new Runnable() { // from class: io.netty.util.concurrent.SingleThreadEventExecutor.5
            /* JADX WARN: Code restructure failed: missing block: B:20:0x00ae, code lost:
            
                r1 = move-exception;
             */
            /* JADX WARN: Code restructure failed: missing block: B:25:0x00f5, code lost:
            
                throw r1;
             */
            /* JADX WARN: Code restructure failed: missing block: B:54:0x0201, code lost:
            
                r1 = move-exception;
             */
            /* JADX WARN: Code restructure failed: missing block: B:55:0x0202, code lost:
            
                io.netty.util.concurrent.SingleThreadEventExecutor.STATE_UPDATER.set(r9.this$0, 5);
                r9.this$0.threadLock.release();
             */
            /* JADX WARN: Code restructure failed: missing block: B:56:0x021e, code lost:
            
                if (r9.this$0.taskQueue.isEmpty() == false) goto L57;
             */
            /* JADX WARN: Code restructure failed: missing block: B:57:0x0220, code lost:
            
                r4 = io.netty.util.concurrent.SingleThreadEventExecutor.logger;
                r0 = g.a.a.a.a.F("An event executor terminated with non-empty task queue (");
                r0.append(r9.this$0.taskQueue.size());
                r0.append(')');
                r4.warn(r0.toString());
             */
            /* JADX WARN: Code restructure failed: missing block: B:58:0x023f, code lost:
            
                r9.this$0.terminationFuture.setSuccess(null);
             */
            /* JADX WARN: Code restructure failed: missing block: B:59:0x0248, code lost:
            
                throw r1;
             */
            /* JADX WARN: Code restructure failed: missing block: B:86:0x0347, code lost:
            
                r1 = move-exception;
             */
            /* JADX WARN: Code restructure failed: missing block: B:87:0x0348, code lost:
            
                io.netty.util.concurrent.SingleThreadEventExecutor.STATE_UPDATER.set(r9.this$0, 5);
                r9.this$0.threadLock.release();
             */
            /* JADX WARN: Code restructure failed: missing block: B:88:0x0364, code lost:
            
                if (r9.this$0.taskQueue.isEmpty() == false) goto L89;
             */
            /* JADX WARN: Code restructure failed: missing block: B:89:0x0366, code lost:
            
                r4 = io.netty.util.concurrent.SingleThreadEventExecutor.logger;
                r0 = g.a.a.a.a.F("An event executor terminated with non-empty task queue (");
                r0.append(r9.this$0.taskQueue.size());
                r0.append(')');
                r4.warn(r0.toString());
             */
            /* JADX WARN: Code restructure failed: missing block: B:90:0x0385, code lost:
            
                r9.this$0.terminationFuture.setSuccess(null);
             */
            /* JADX WARN: Code restructure failed: missing block: B:91:0x038e, code lost:
            
                throw r1;
             */
            @Override // java.lang.Runnable
            /*
                Code decompiled incorrectly, please refer to instructions dump.
                To view partially-correct add '--show-bad-code' argument
            */
            public void run() {
                /*
                    Method dump skipped, instruction units count: 1060
                    To view this dump add '--comments-level debug' option
                */
                throw new UnsupportedOperationException("Method not decompiled: io.netty.util.concurrent.SingleThreadEventExecutor.AnonymousClass5.run():void");
            }
        });
    }

    private boolean fetchFromScheduledTaskQueue() {
        Runnable runnablePollScheduledTask;
        long jNanoTime = AbstractScheduledEventExecutor.nanoTime();
        do {
            runnablePollScheduledTask = pollScheduledTask(jNanoTime);
            if (runnablePollScheduledTask == null) {
                return true;
            }
        } while (this.taskQueue.offer(runnablePollScheduledTask));
        scheduledTaskQueue().add((ScheduledFutureTask) runnablePollScheduledTask);
        return false;
    }

    public static Runnable pollTaskFrom(Queue<Runnable> queue) {
        Runnable runnablePoll;
        do {
            runnablePoll = queue.poll();
        } while (runnablePoll == WAKEUP_TASK);
        return runnablePoll;
    }

    public static void reject() {
        throw new RejectedExecutionException("event executor terminated");
    }

    private boolean runShutdownHooks() {
        boolean z2 = false;
        while (!this.shutdownHooks.isEmpty()) {
            ArrayList arrayList = new ArrayList(this.shutdownHooks);
            this.shutdownHooks.clear();
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                try {
                    ((Runnable) it.next()).run();
                } finally {
                }
                z2 = true;
            }
        }
        if (z2) {
            this.lastExecutionTime = ScheduledFutureTask.nanoTime();
        }
        return z2;
    }

    private void startThread() {
        if (this.state == 1 && STATE_UPDATER.compareAndSet(this, 1, 2)) {
            try {
                doStartThread();
            } catch (Throwable th) {
                STATE_UPDATER.set(this, 1);
                PlatformDependent.throwException(th);
            }
        }
    }

    private void throwIfInEventLoop(String str) {
        if (inEventLoop()) {
            throw new RejectedExecutionException(a.u("Calling ", str, " from within the EventLoop is not allowed"));
        }
    }

    public void addShutdownHook(final Runnable runnable) {
        if (inEventLoop()) {
            this.shutdownHooks.add(runnable);
        } else {
            execute(new Runnable() { // from class: io.netty.util.concurrent.SingleThreadEventExecutor.3
                @Override // java.lang.Runnable
                public void run() {
                    SingleThreadEventExecutor.this.shutdownHooks.add(runnable);
                }
            });
        }
    }

    public void addTask(Runnable runnable) {
        Objects.requireNonNull(runnable, "task");
        if (offerTask(runnable)) {
            return;
        }
        reject(runnable);
    }

    public void afterRunningAllTasks() {
    }

    @Override // java.util.concurrent.ExecutorService
    public boolean awaitTermination(long j2, TimeUnit timeUnit) {
        Objects.requireNonNull(timeUnit, "unit");
        if (inEventLoop()) {
            throw new IllegalStateException("cannot await termination of the current thread");
        }
        if (this.threadLock.tryAcquire(j2, timeUnit)) {
            this.threadLock.release();
        }
        return isTerminated();
    }

    public void cleanup() {
    }

    public boolean confirmShutdown() {
        if (!isShuttingDown()) {
            return false;
        }
        if (!inEventLoop()) {
            throw new IllegalStateException("must be invoked from an event loop");
        }
        cancelScheduledTasks();
        if (this.gracefulShutdownStartTime == 0) {
            this.gracefulShutdownStartTime = ScheduledFutureTask.nanoTime();
        }
        if (runAllTasks() || runShutdownHooks()) {
            if (isShutdown() || this.gracefulShutdownQuietPeriod == 0) {
                return true;
            }
            wakeup(true);
            return false;
        }
        long jNanoTime = ScheduledFutureTask.nanoTime();
        if (isShutdown() || jNanoTime - this.gracefulShutdownStartTime > this.gracefulShutdownTimeout || jNanoTime - this.lastExecutionTime > this.gracefulShutdownQuietPeriod) {
            return true;
        }
        wakeup(true);
        try {
            Thread.sleep(100L);
        } catch (InterruptedException unused) {
        }
        return false;
    }

    public long delayNanos(long j2) {
        ScheduledFutureTask<?> scheduledFutureTaskPeekScheduledTask = peekScheduledTask();
        return scheduledFutureTaskPeekScheduledTask == null ? SCHEDULE_PURGE_INTERVAL : scheduledFutureTaskPeekScheduledTask.delayNanos(j2);
    }

    @Override // java.util.concurrent.Executor
    public void execute(Runnable runnable) {
        Objects.requireNonNull(runnable, "task");
        boolean zInEventLoop = inEventLoop();
        if (zInEventLoop) {
            addTask(runnable);
        } else {
            startThread();
            addTask(runnable);
            if (isShutdown() && removeTask(runnable)) {
                reject();
            }
        }
        if (this.addTaskWakesUp || !wakesUpForTask(runnable)) {
            return;
        }
        wakeup(zInEventLoop);
    }

    public boolean hasTasks() {
        return !this.taskQueue.isEmpty();
    }

    @Override // io.netty.util.concurrent.EventExecutor
    public boolean inEventLoop(Thread thread) {
        return thread == this.thread;
    }

    public void interruptThread() {
        Thread thread = this.thread;
        if (thread == null) {
            this.interrupted = true;
        } else {
            thread.interrupt();
        }
    }

    @Override // java.util.concurrent.AbstractExecutorService, java.util.concurrent.ExecutorService
    public <T> List<java.util.concurrent.Future<T>> invokeAll(Collection<? extends Callable<T>> collection) {
        throwIfInEventLoop("invokeAll");
        return super.invokeAll(collection);
    }

    @Override // java.util.concurrent.AbstractExecutorService, java.util.concurrent.ExecutorService
    public <T> List<java.util.concurrent.Future<T>> invokeAll(Collection<? extends Callable<T>> collection, long j2, TimeUnit timeUnit) {
        throwIfInEventLoop("invokeAll");
        return super.invokeAll(collection, j2, timeUnit);
    }

    @Override // java.util.concurrent.AbstractExecutorService, java.util.concurrent.ExecutorService
    public <T> T invokeAny(Collection<? extends Callable<T>> collection) {
        throwIfInEventLoop("invokeAny");
        return (T) super.invokeAny(collection);
    }

    @Override // java.util.concurrent.AbstractExecutorService, java.util.concurrent.ExecutorService
    public <T> T invokeAny(Collection<? extends Callable<T>> collection, long j2, TimeUnit timeUnit) {
        throwIfInEventLoop("invokeAny");
        return (T) super.invokeAny(collection, j2, timeUnit);
    }

    @Override // java.util.concurrent.ExecutorService
    public boolean isShutdown() {
        return this.state >= 4;
    }

    @Override // io.netty.util.concurrent.EventExecutorGroup
    public boolean isShuttingDown() {
        return this.state >= 3;
    }

    @Override // java.util.concurrent.ExecutorService
    public boolean isTerminated() {
        return this.state == 5;
    }

    @Deprecated
    public Queue<Runnable> newTaskQueue() {
        return newTaskQueue(this.maxPendingTasks);
    }

    public Queue<Runnable> newTaskQueue(int i2) {
        return new LinkedBlockingQueue(i2);
    }

    public final boolean offerTask(Runnable runnable) {
        if (isShutdown()) {
            reject();
        }
        return this.taskQueue.offer(runnable);
    }

    public Runnable peekTask() {
        return this.taskQueue.peek();
    }

    public int pendingTasks() {
        return this.taskQueue.size();
    }

    public Runnable pollTask() {
        return pollTaskFrom(this.taskQueue);
    }

    public final void reject(Runnable runnable) {
        this.rejectedExecutionHandler.rejected(runnable, this);
    }

    public void removeShutdownHook(final Runnable runnable) {
        if (inEventLoop()) {
            this.shutdownHooks.remove(runnable);
        } else {
            execute(new Runnable() { // from class: io.netty.util.concurrent.SingleThreadEventExecutor.4
                @Override // java.lang.Runnable
                public void run() {
                    SingleThreadEventExecutor.this.shutdownHooks.remove(runnable);
                }
            });
        }
    }

    public boolean removeTask(Runnable runnable) {
        Objects.requireNonNull(runnable, "task");
        return this.taskQueue.remove(runnable);
    }

    public abstract void run();

    public boolean runAllTasks() {
        boolean zFetchFromScheduledTaskQueue;
        boolean z2 = false;
        do {
            zFetchFromScheduledTaskQueue = fetchFromScheduledTaskQueue();
            if (runAllTasksFrom(this.taskQueue)) {
                z2 = true;
            }
        } while (!zFetchFromScheduledTaskQueue);
        if (z2) {
            this.lastExecutionTime = ScheduledFutureTask.nanoTime();
        }
        afterRunningAllTasks();
        return z2;
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x002c  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean runAllTasks(long r8) {
        /*
            r7 = this;
            r7.fetchFromScheduledTaskQueue()
            java.lang.Runnable r0 = r7.pollTask()
            if (r0 != 0) goto Le
            r7.afterRunningAllTasks()
            r8 = 0
            return r8
        Le:
            long r1 = io.netty.util.concurrent.ScheduledFutureTask.nanoTime()
            long r1 = r1 + r8
            r8 = 0
            r3 = r8
        L16:
            io.netty.util.concurrent.AbstractEventExecutor.safeExecute(r0)
            r5 = 1
            long r3 = r3 + r5
            r5 = 63
            long r5 = r5 & r3
            int r0 = (r5 > r8 ? 1 : (r5 == r8 ? 0 : -1))
            if (r0 != 0) goto L2c
            long r5 = io.netty.util.concurrent.ScheduledFutureTask.nanoTime()
            int r0 = (r5 > r1 ? 1 : (r5 == r1 ? 0 : -1))
            if (r0 < 0) goto L2c
            goto L36
        L2c:
            java.lang.Runnable r0 = r7.pollTask()
            if (r0 != 0) goto L16
            long r5 = io.netty.util.concurrent.ScheduledFutureTask.nanoTime()
        L36:
            r7.afterRunningAllTasks()
            r7.lastExecutionTime = r5
            r8 = 1
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(long):boolean");
    }

    public final boolean runAllTasksFrom(Queue<Runnable> queue) {
        Runnable runnablePollTaskFrom = pollTaskFrom(queue);
        if (runnablePollTaskFrom == null) {
            return false;
        }
        do {
            AbstractEventExecutor.safeExecute(runnablePollTaskFrom);
            runnablePollTaskFrom = pollTaskFrom(queue);
        } while (runnablePollTaskFrom != null);
        return true;
    }

    @Override // io.netty.util.concurrent.AbstractEventExecutor, java.util.concurrent.ExecutorService, io.netty.util.concurrent.EventExecutorGroup
    @Deprecated
    public void shutdown() {
        boolean z2;
        if (isShutdown()) {
            return;
        }
        boolean zInEventLoop = inEventLoop();
        while (!isShuttingDown()) {
            int i2 = this.state;
            int i3 = 4;
            if (zInEventLoop || i2 == 1 || i2 == 2 || i2 == 3) {
                z2 = true;
            } else {
                z2 = false;
                i3 = i2;
            }
            if (STATE_UPDATER.compareAndSet(this, i2, i3)) {
                if (i2 == 1) {
                    try {
                        doStartThread();
                    } catch (Throwable th) {
                        STATE_UPDATER.set(this, 5);
                        this.terminationFuture.tryFailure(th);
                        if (th instanceof Exception) {
                            return;
                        }
                        PlatformDependent.throwException(th);
                        return;
                    }
                }
                if (z2) {
                    wakeup(zInEventLoop);
                    return;
                }
                return;
            }
        }
    }

    @Override // io.netty.util.concurrent.EventExecutorGroup
    public Future<?> shutdownGracefully(long j2, long j3, TimeUnit timeUnit) {
        boolean z2;
        if (j2 < 0) {
            throw new IllegalArgumentException(a.r("quietPeriod: ", j2, " (expected >= 0)"));
        }
        if (j3 < j2) {
            throw new IllegalArgumentException("timeout: " + j3 + " (expected >= quietPeriod (" + j2 + "))");
        }
        Objects.requireNonNull(timeUnit, "unit");
        if (isShuttingDown()) {
            return terminationFuture();
        }
        boolean zInEventLoop = inEventLoop();
        while (!isShuttingDown()) {
            int i2 = this.state;
            int i3 = 3;
            if (zInEventLoop || i2 == 1 || i2 == 2) {
                z2 = true;
            } else {
                z2 = false;
                i3 = i2;
            }
            if (STATE_UPDATER.compareAndSet(this, i2, i3)) {
                this.gracefulShutdownQuietPeriod = timeUnit.toNanos(j2);
                this.gracefulShutdownTimeout = timeUnit.toNanos(j3);
                if (i2 == 1) {
                    try {
                        doStartThread();
                    } catch (Throwable th) {
                        STATE_UPDATER.set(this, 5);
                        this.terminationFuture.tryFailure(th);
                        if (!(th instanceof Exception)) {
                            PlatformDependent.throwException(th);
                        }
                        return this.terminationFuture;
                    }
                }
                if (z2) {
                    wakeup(zInEventLoop);
                }
                return terminationFuture();
            }
        }
        return terminationFuture();
    }

    public Runnable takeTask() {
        Runnable runnable;
        Queue<Runnable> queue = this.taskQueue;
        if (!(queue instanceof BlockingQueue)) {
            throw new UnsupportedOperationException();
        }
        BlockingQueue blockingQueue = (BlockingQueue) queue;
        do {
            ScheduledFutureTask<?> scheduledFutureTaskPeekScheduledTask = peekScheduledTask();
            runnable = null;
            if (scheduledFutureTaskPeekScheduledTask == null) {
                try {
                    Runnable runnable2 = (Runnable) blockingQueue.take();
                    try {
                        if (runnable2 == WAKEUP_TASK) {
                            return null;
                        }
                    } catch (InterruptedException unused) {
                    }
                    return runnable2;
                } catch (InterruptedException unused2) {
                    return null;
                }
            }
            long jDelayNanos = scheduledFutureTaskPeekScheduledTask.delayNanos();
            if (jDelayNanos > 0) {
                try {
                    runnable = (Runnable) blockingQueue.poll(jDelayNanos, TimeUnit.NANOSECONDS);
                } catch (InterruptedException unused3) {
                    return null;
                }
            }
            if (runnable == null) {
                fetchFromScheduledTaskQueue();
                runnable = (Runnable) blockingQueue.poll();
            }
        } while (runnable == null);
        return runnable;
    }

    @Override // io.netty.util.concurrent.EventExecutorGroup
    public Future<?> terminationFuture() {
        return this.terminationFuture;
    }

    public final ThreadProperties threadProperties() {
        ThreadProperties threadProperties = this.threadProperties;
        if (threadProperties != null) {
            return threadProperties;
        }
        Thread thread = this.thread;
        if (thread == null) {
            submit(NOOP_TASK).syncUninterruptibly();
            thread = this.thread;
        }
        DefaultThreadProperties defaultThreadProperties = new DefaultThreadProperties(thread);
        return !PROPERTIES_UPDATER.compareAndSet(this, null, defaultThreadProperties) ? this.threadProperties : defaultThreadProperties;
    }

    public void updateLastExecutionTime() {
        this.lastExecutionTime = ScheduledFutureTask.nanoTime();
    }

    public boolean wakesUpForTask(Runnable runnable) {
        return true;
    }

    public void wakeup(boolean z2) {
        if (!z2 || this.state == 3) {
            this.taskQueue.offer(WAKEUP_TASK);
        }
    }
}
