SingleThreadEventExecutor extends AbstractScheduledEventExecutor implements OrderedEventExecutor { public final ThreadProperties threadProperties() { ThreadProperties threadProperties = this.threadProperties; if (threadProperties == null) { Thread thread = this.thread; if (thread == null) { assert !inEventLoop(); submit(NOOP_TASK).syncUninterruptibly(); thread = this.thread; assert thread != null; } threadProperties = new DefaultThreadProperties(thread); if (!PROPERTIES_UPDATER.compareAndSet(this, null, threadProperties)) { threadProperties = this.threadProperties; } } return threadProperties; } protected  SingleThreadEventExecutor(
            EventExecutorGroup parent, ThreadFactory threadFactory, boolean addTaskWakesUp); protected  SingleThreadEventExecutor(
            EventExecutorGroup parent, ThreadFactory threadFactory,
            boolean addTaskWakesUp, int maxPendingTasks, RejectedExecutionHandler rejectedHandler); protected  SingleThreadEventExecutor(EventExecutorGroup parent, Executor executor, boolean addTaskWakesUp); protected  SingleThreadEventExecutor(EventExecutorGroup parent, Executor executor,
                                        boolean addTaskWakesUp, int maxPendingTasks,
                                        RejectedExecutionHandler rejectedHandler); int pendingTasks(); @Override boolean inEventLoop(Thread thread); void addShutdownHook(final Runnable task); void removeShutdownHook(final Runnable task); @Override Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit); @Override Future<?> terminationFuture(); @Override @Deprecated void shutdown(); @Override boolean isShuttingDown(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override void execute(Runnable task); @Override T invokeAny(Collection<? extends Callable<T>> tasks); @Override T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); @Override List<java.util.concurrent.Future<T>> invokeAll(Collection<? extends Callable<T>> tasks); @Override List<java.util.concurrent.Future<T>> invokeAll(
            Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); final ThreadProperties threadProperties();  }
@Test public void testThreadProperties() { final AtomicReference<Thread> threadRef = new AtomicReference<Thread>(); SingleThreadEventExecutor executor = new SingleThreadEventExecutor( null, new DefaultThreadFactory("test"), false) { @Override protected void run() { threadRef.set(Thread.currentThread()); while (!confirmShutdown()) { Runnable task = takeTask(); if (task != null) { task.run(); } } } }; ThreadProperties threadProperties = executor.threadProperties(); Thread thread = threadRef.get(); Assert.assertEquals(thread.getId(), threadProperties.id()); Assert.assertEquals(thread.getName(), threadProperties.name()); Assert.assertEquals(thread.getPriority(), threadProperties.priority()); Assert.assertEquals(thread.isAlive(), threadProperties.isAlive()); Assert.assertEquals(thread.isDaemon(), threadProperties.isDaemon()); Assert.assertTrue(threadProperties.stackTrace().length > 0); executor.shutdownGracefully(); }