Home / Class/ AccountingThreadFactory Class — netty Architecture

AccountingThreadFactory Class — netty Architecture

Architecture documentation for the AccountingThreadFactory class in UnorderedThreadPoolEventExecutor.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c8a4f057_e353_8cca_eb43_2f3e8de9e7f0["AccountingThreadFactory"]
  4144915c_b885_a14e_a96d_7cc1d80f9535["UnorderedThreadPoolEventExecutor.java"]
  c8a4f057_e353_8cca_eb43_2f3e8de9e7f0 -->|defined in| 4144915c_b885_a14e_a96d_7cc1d80f9535
  300f1034_e544_0a88_9c63_151291ee2113["AccountingThreadFactory()"]
  c8a4f057_e353_8cca_eb43_2f3e8de9e7f0 -->|method| 300f1034_e544_0a88_9c63_151291ee2113
  cc4b21f4_19e2_d6bd_4a76_63e131883831["Thread()"]
  c8a4f057_e353_8cca_eb43_2f3e8de9e7f0 -->|method| cc4b21f4_19e2_d6bd_4a76_63e131883831

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/UnorderedThreadPoolEventExecutor.java lines 307–327

    private static final class AccountingThreadFactory implements ThreadFactory {
        private final ThreadFactory delegate;
        private final Set<Thread> threads;

        private AccountingThreadFactory(ThreadFactory delegate, Set<Thread> threads) {
            this.delegate = delegate;
            this.threads = threads;
        }

        @Override
        public Thread newThread(@NotNull Runnable r) {
            return delegate.newThread(() -> {
                threads.add(Thread.currentThread());
                try {
                    r.run();
                } finally {
                    threads.remove(Thread.currentThread());
                }
            });
        }
    }

Frequently Asked Questions

What is the AccountingThreadFactory class?
AccountingThreadFactory is a class in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/UnorderedThreadPoolEventExecutor.java.
Where is AccountingThreadFactory defined?
AccountingThreadFactory is defined in common/src/main/java/io/netty/util/concurrent/UnorderedThreadPoolEventExecutor.java at line 307.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free